[R] Set encoding when load()-ing workspaces?

Gustaf Rydevik gustaf.rydevik at gmail.com
Sun May 2 17:41:30 CEST 2010


Hi all,

I hope that there is someone that can help me out here.
I am trying to load() a workspace on os x (R 2.11.0) that was saved in
windows XP (R 2.9). In that workspace, there's a data.frame with names
that contain swedish characters. These characters become garbled,
which is a major problem.
>From the R windows FAQ, I read:

"Note though that character data in a workspace will be in a
particular encoding that is not recorded in the workspace, so
workspaces containing non-ASCII character data may not be
interchangeable even on the same OS. Since R marks character data when
it knows it to be in UTF-8 or Latin-1 (including its Windows superset,
CP1252), strings in those encodings are likely to be transferred
correctly: fortunately this covers most of the common cases (Mac OS X
normally uses UTF-8, and Linux users are likely to use UTF-8 or
perhaps Latin-1 (which used to be used for English)). "

Apparently, my case is not the most common one, and I don't know why.
I've been trying to dig into the load() function, but since it uses a
lot of .Internal functions, I get stuck there.
I've also tried doing options(encoding="latin1"), which doesn't seem
to change anything.

And now I'm stuck. Any suggestions on where to look?
I've run into this issue twice before. The first time I managed to get
it solved, but can't remember how (perhaps a .Rprofile setting
somewhere?).
The second time, I mailed R-Sig-Mac, got some tips that unfortunately
did not lead anywhere, and subsequently gave up. I hope third time's a
charm!

Many thanks in advance,
Gustaf


-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik



More information about the R-help mailing list