Encoding issue when running an R-script in a batch file

Viewed 1315

Using a batch file in Windows (.bat) I am unable to run an R-script, which contains the letter ä. The R-script (one_line.R) is only one line:

df <- read.csv2("filename_ä.csv")

When changing the letter "ä" to "a", it works using the batch file. Running the script in RStudio, after having re-opened the script with encoding UTF-8, it works even with the letter "ä" in the file name. Surely there must be a way of successfully running the script using the batch file too, but how?

The .bat-file is also very simple:

"C:\R\R-3.3.2\bin\x64\R.exe" CMD BATCH "C:\one_line.R"

Thank you!

0 Answers
Related