Dear R-help mailing list, I have a drawing problem with R: I need to draw an horizontal axis with date, here is the test code:> ticks <- c("2004-01-22","2005-01-22","2006-01-22","2007-01-22","2008-01-22","2009-01-22","2010-01-22","2011-01-22","2012-01-22")> ats <- ticks[seq(1,length(ticks))] > lbl <- strftime(ats,"%b %y") > lbl > [1] "Ò»ÔÂ 04" "Ò»ÔÂ 05" "Ò»ÔÂ 06" "Ò»ÔÂ 07" "Ò»ÔÂ 08" "Ò»ÔÂ 09" "Ò»ÔÂ 10" "Ò»ÔÂ 11" "Ò»ÔÂ12" I have changed the R environment to English and why was "lbl" shown to be Chinese instead of English? Hopefully this can be resolved. Any tips would be greatly appreciated. Thanks in advance, Derrick [[alternative HTML version deleted]]
R. Michael Weylandt <michael.weylandt@gmail.com>
2012-Aug-14 03:13 UTC
[R] A drawing problem with R
What's your sessionInfo()? And how did you Change the locale? And what was your actual plot command and graphics device? Michael On Aug 13, 2012, at 10:17 PM, Derrick Guan <guanyonghui89 at gmail.com> wrote:> Dear R-help mailing list, > > I have a drawing problem with R: > > I need to draw an horizontal axis with date, here is the test code: > >> ticks <- c("2004-01-22","2005-01-22","2006-01-22","2007-01- > 22","2008-01-22","2009-01-22","2010-01-22","2011-01-22","2012-01-22") >> ats <- ticks[seq(1,length(ticks))] >> lbl <- strftime(ats,"%b %y") >> lbl >> [1] "??? 04" "??? 05" "??? 06" "??? 07" "??? 08" "??? 09" "??? 10" "??? 11" "??? > 12" > > I have changed the R environment to English and why was "lbl" shown to be > Chinese instead of English? > > Hopefully this can be resolved. Any tips would be greatly appreciated. > Thanks in advance, > > Derrick > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
R. Michael Weylandt <michael.weylandt@gmail.com>
2012-Aug-14 03:46 UTC
[R] A drawing problem with R
Please keep your replies on list so you can ask a wider audience. In this case, I haven't used Windows in years, so someone else will have to take a look. I do think you probably need to use Sys.setenv() to change the locale from within R Cheers, Michael On Aug 13, 2012, at 11:27 PM, Derrick Guan <guanyonghui89@gmail.com> wrote:> My sessionInfo() is as follow: > R version 2.15.0 (2012-03-30) > Platform: i386-pc-mingw32/i386 (32-bit) > > locale: > [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 > [2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936 > [3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936 > [4] LC_NUMERIC=C > [5] LC_TIME=Chinese (Simplified)_People's Republic of China.936 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > And I changed the R Console to English by adding "language=English" to R properties->Target > > 2012/8/14 R. Michael Weylandt <michael.weylandt@gmail.com> <michael.weylandt@gmail.com> > What's your sessionInfo()? And how did you Change the locale? And what was your actual plot command and graphics device? > > Michael > > On Aug 13, 2012, at 10:17 PM, Derrick Guan <guanyonghui89@gmail.com> wrote: > > > Dear R-help mailing list, > > > > I have a drawing problem with R: > > > > I need to draw an horizontal axis with date, here is the test code: > > > >> ticks <- c("2004-01-22","2005-01-22","2006-01-22","2007-01- > > 22","2008-01-22","2009-01-22","2010-01-22","2011-01-22","2012-01-22") > >> ats <- ticks[seq(1,length(ticks))] > >> lbl <- strftime(ats,"%b %y") > >> lbl > >> [1] "һ�� 04" "һ�� 05" "һ�� 06" "һ�� 07" "һ�� 08" "һ�� 09" "һ�� 10" "һ�� 11" "һ�� > > 12" > > > > I have changed the R environment to English and why was "lbl" shown to be > > Chinese instead of English? > > > > Hopefully this can be resolved. Any tips would be greatly appreciated. > > Thanks in advance, > > > > Derrick > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > 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. >[[alternative HTML version deleted]]