Scheduling a script in R with encoding

385 Views Asked by At

I have a script in R, task.R, that reads in a .csv file, does bunch of calculations and writes a new .csv file with the final data. I'm having trouble with special characters (Icelandic), e.g. æ, á, ú etc. As an example, when I source task.R, Ára becomes ára. If I use source("task.R", encoding = "UTF-8") everything is fine.

I want to use the taskscheduleR package in R which basically source the task.R script. But because of the encoding problem, I have to create new script e.g. source_task.R with only one line of code: source("task.R", encoding = "UTF-8").
Is there any way to use the taskscheduleR package and somehow use encoding = "UTF-8" without having to create new script like source_task.R?

1

There are 1 best solutions below

0
Zenos On

You can open the R file with Notepad, and save it with ANSI encoding.

This is a ridiculous solution, but it works.

Did you happen to find any other solutions?