0

I am trying to load a data frame in R, which contains the Danish letters Æ, Ø and Å, in some of the column names (Not the values of the columns).

Once in the correct working directory I use the load function:

load("DM_OLS_1_new.rdata")

It loads the data into a data frame that looks fine, except for the column names containing the above mentioned letters. E.g. the column name

"KOMMUNE_ALLERØD"

is loaded as

"KOMMUNE.ALLER\xd8D "

I am pretty sure that the problem is not in the file, since it can be loaded correctly on other computers running windows. I am running Xubuntu. I have tried changing Encoding to ISO-8859-1 and WINDOWS-1252 but it doesnt change anything.

Math_kv
  • 309
  • 3
  • 10
  • 1
    How do you save this .rdata file? Are you using `save`? Try playing with `Sys.setlocale` and set to something that supports UTF-8. Something along the lines of http://stackoverflow.com/questions/20577764/set-locale-to-system-default-utf-8 – Roman Luštrik Feb 11 '16 at 14:53
  • If I run `xxx <- "ISHØJ" ; save(xxx, file="test.rda")` and then start another R session and run `load("test.rda") ; print(xxx)` then I get the correct answer. Have you seen [this link](http://withr.me/configure-character-encoding-for-r-under-linux-and-windows/)? – ekstroem Feb 11 '16 at 20:45

0 Answers0