[R] data frames with å, ä, and ö (=n on-ASCII-characters) from windows to mac os x

2009-01-16 Thread Gustaf Rydevik
Hi,
I ran into this issue previously and managed to solve it, but I've
forgotten how and am getting frustrated...

I have a data frame (see below) with scandinavian characters in R
(2.7.1) running on a Win Xp-computer. I save the data frame in an
RData-file on a usb stick, and load() it in R (2.8.0) running on OS X
10.5. Now the name of the data frame and all factor labels with
scandinavian characters are scrambled. How do I make R in OS X read my
data frame?
From what I've managed to find in the list archives and the FAQ I either
1) run
 Sys.setlocale(LC_ALL,en_US.UTF-8) ### Doesn't change anything
or
2) run
  defaults write org.R-project.R force.LANG en_US.UTF-8
in the terminal, which doesn't help either.
I must admit that I couldn't quite follow what documentation i found
on locales, so I might have messed up somewhere along the line.

Many thanks in advance for your help!

Regards,

Gustaf




Länkarta -
structure(list(LANKOD = structure(c(11L, 19L, 10L, 13L, 21L,
7L, 9L, 18L, 8L, 3L, 16L, 6L, 5L, 4L, 15L, 2L, 20L, 17L, 1L,
14L, 12L), .Label = c(AB, AC, BD, C, D, E, F, G,
H, I, K, M, N, O, S, T, U, W, X, Y, Z
), class = factor), Län = structure(c(1L, 4L, 3L, 5L, 6L, 7L,
8L, 2L, 9L, 10L, 20L, 21L, 13L, 14L, 15L, 16L, 17L, 18L, 12L,
19L, 11L), .Label = c(Blekinge län, Dalarnas län, Gotlands län,
Gävleborgs län, Hallands län, Jämtlands län, Jönköpings län,
Kalmar län, Kronobergs län, Norrbottens län, Skåne län,
Stockholms län, Södermanlands län, Uppsala län, Värmlands län,
Västerbottens län, Västernorrlands län, Västmanlands län,
Västra Götalands län, Örebro län, Östergötlands län), class =
factor)), .Names = c(LANKOD,
Län), class = data.frame, row.names = c(0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20))



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] data frames with å, ä, and ö (=n on-ASCII-characters) from windows to mac os x

2009-01-16 Thread Ivan Alves

Hi,

On my system (see below), it works fine (inputing the code below at  
the R prompt).  Make sure that the encoding of the input file is  
encoded UTF-8.


Rgds,

Ivan

 sessionInfo()
R version 2.8.1 Patched (2009-01-14 r47602)
i386-apple-darwin9.6.0

locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base
 structure(list(LANKOD = structure(c(11L, 19L, 10L, 13L, 21L,7L, 9L,  
18L, 8L, 3L, 16L, 6L, 5L, 4L, 15L, 2L, 20L, 17L, 1L,14L, 12L), .Label  
= c(AB, AC, BD, C, D, E, F, G,H, I, K, M, N,  
O, S, T, U, W, X, Y, Z), class = factor), Län =  
structure(c(1L, 4L, 3L, 5L, 6L, 7L,8L, 2L, 9L, 10L, 20L, 21L, 13L,  
14L, 15L, 16L, 17L, 18L, 12L,19L, 11L), .Label = c(Blekinge län,  
Dalarnas län, Gotlands län,Gävleborgs län,Hallands län,  
Jämtlands län, Jönköpings län,Kalmar län, Kronobergs län,  
Norrbottens län, Skåne län,Stockholms län, Södermanlands län,  
Uppsala län, Värmlands län,Västerbottens län, Västernorrlands  
län, Västmanlands län,Västra Götalands län, Örebro län,  
Östergötlands län), class =factor)), .Names = c(LANKOD,Län),  
class = data.frame, row.names = c(0, 1, 2, 3,4, 5, 6,  
7, 8, 9, 10, 11, 12, 13, 14, 15,16, 17, 18,  
19, 20))

   LANKOD  Län
0   K Blekinge län
1   X   Gävleborgs län
2   I Gotlands län
3   N Hallands län
4   ZJämtlands län
5   F   Jönköpings län
6   H   Kalmar län
7   W Dalarnas län
8   G   Kronobergs län
9  BD  Norrbottens län
10  T   Örebro län
11  EÖstergötlands län
12  DSödermanlands län
13  C  Uppsala län
14  SVärmlands län
15 ACVästerbottens län
16  Y  Västernorrlands län
17  U Västmanlands län
18 AB   Stockholms län
19  O Västra Götalands län
20  MSkåne län
 Länkarta - structure(list(LANKOD = structure(c(11L, 19L, 10L, 13L,  
21L,7L, 9L, 18L, 8L, 3L, 16L, 6L, 5L, 4L, 15L, 2L, 20L, 17L, 1L,14L,  
12L), .Label = c(AB, AC, BD, C, D, E, F, G,H, I,  
K, M, N, O, S, T, U, W, X, Y, Z), class =  
factor), Län = structure(c(1L, 4L, 3L, 5L, 6L, 7L,8L, 2L, 9L, 10L,  
20L, 21L, 13L, 14L, 15L, 16L, 17L, 18L, 12L,19L, 11L), .Label =  
c(Blekinge län, Dalarnas län, Gotlands län,Gävleborgs  
län,Hallands län, Jämtlands län, Jönköpings län,Kalmar län,  
Kronobergs län, Norrbottens län, Skåne län,Stockholms län,  
Södermanlands län, Uppsala län, Värmlands län,Västerbottens  
län, Västernorrlands län, Västmanlands län,Västra Götalands  
län, Örebro län, Östergötlands län), class =factor)), .Names =  
c(LANKOD,Län), class = data.frame, row.names = c(0, 1, 2,  
3,4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,  
15,16, 17, 18, 19, 20))

 ls()
[1] Länkarta

On 16 Jan 2009, at 14:13, Gustaf Rydevik wrote:


Hi,
I ran into this issue previously and managed to solve it, but I've
forgotten how and am getting frustrated...

I have a data frame (see below) with scandinavian characters in R
(2.7.1) running on a Win Xp-computer. I save the data frame in an
RData-file on a usb stick, and load() it in R (2.8.0) running on OS X
10.5. Now the name of the data frame and all factor labels with
scandinavian characters are scrambled. How do I make R in OS X read my
data frame?
From what I've managed to find in the list archives and the FAQ I  
either

1) run
Sys.setlocale(LC_ALL,en_US.UTF-8) ### Doesn't change anything
or
2) run
 defaults write org.R-project.R force.LANG en_US.UTF-8
in the terminal, which doesn't help either.
I must admit that I couldn't quite follow what documentation i found
on locales, so I might have messed up somewhere along the line.

Many thanks in advance for your help!

Regards,

Gustaf




Länkarta -
structure(list(LANKOD = structure(c(11L, 19L, 10L, 13L, 21L,
7L, 9L, 18L, 8L, 3L, 16L, 6L, 5L, 4L, 15L, 2L, 20L, 17L, 1L,
14L, 12L), .Label = c(AB, AC, BD, C, D, E, F, G,
H, I, K, M, N, O, S, T, U, W, X, Y, Z
), class = factor), Län = structure(c(1L, 4L, 3L, 5L, 6L, 7L,
8L, 2L, 9L, 10L, 20L, 21L, 13L, 14L, 15L, 16L, 17L, 18L, 12L,
19L, 11L), .Label = c(Blekinge län, Dalarnas län, Gotlands län,
Gävleborgs län, Hallands län, Jämtlands län, Jönköpings län,
Kalmar län, Kronobergs län, Norrbottens län, Skåne län,
Stockholms län, Södermanlands län, Uppsala län, Värmlands län,
Västerbottens län, Västernorrlands län, Västmanlands län,
Västra Götalands län, Örebro län, Östergötlands län), class =
factor)), .Names = c(LANKOD,
Län), class = data.frame, row.names = c(0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20))



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide