bnosac / taskscheduleR

Schedule R scripts/processes with the Windows task scheduler.
331 stars 72 forks source link

Question: using encoding when scheduling task #72

Closed Vidaringa closed 4 years ago

Vidaringa commented 4 years ago

I'm using the RStudio addin to schedule tasks. I'm having trouble with Icelandic letters. What I normally do is instead of scheduling the script task.R I create new file source_task.R where source_task.R has only one line of code: source(task.R, encoding = "UTF-8"). Is there any way for me to do this differently. I.e. scheduling task.R and use encoding = "UTF-8"?

jwijffels commented 4 years ago

Hava you tried scheduling task.R?

Vidaringa commented 4 years ago

When I schedule task.R characters like Á, Þ, Æ, Ö will change. For example, Ára becomes ára. Fixing this involves creating new .R file like source_task.R and schedule it instead. The source_task.R only contains one line of code i.e. source(task.R, encoding = "UTF-8").

I was wondering if I would skip this extra step of creating source_task.R?

jwijffels commented 4 years ago

It is unclear to me based on your description where and when you get this change in encoding related text. When saving code, running code, printing code?

Vidaringa commented 4 years ago

I'm sorry that I'm not clear enough. I have two options. Scheduling task.R or source_task.R. task.R has bunch of code where I read in .csv files, make some calculations and then I write the final data frame to a .csv file. This way words like Ára becomes ára in the final data frame that I write to .csv file. The other option is to schedule source_task.R which has only one line of code whihc is source(task.R, encoding = "UTF-8"). This way, everything works fine and the final data frame that I write as a .csv file has Ára.

jwijffels commented 4 years ago

This is not related to this package. Just make sure you write data to your csv in the right encoding. Not related to this package.