I am from Denmark and need to be able to use danish letters in my R-code.

If I add some code like:

print("Århus er bare øv...")

and save it as an R-script file in R-studio, the next time I open the file in R-studio I get:

print("?rhus er bare ?v...")
有帮助吗?

解决方案

When saving your file, use File -> Save with encoding and select e.g. "UTF-8". If the file is read incorrectly next time, use File -> Reopen with encoding.

You may also change the RStudio preferences (Tools -> Global options / General->Default text encoding) and set "UTF-8".

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top