Dear r-helpers, This is a little bit more of a Windows problem than an R problem, but ... any idea how to query the *available* locales from within R (or otherwise) on a Windows system? Teaching in a Spanish-language setting and would like to do something like Sys.setlocale("LC_TIME","en_US") (for example so that we can convert dates like "1970-jan-01" with as.Date(x,"%Y-%b-%d") but keep getting reports that this is not honored by the OS. Does anyone have useful pointers? thanks Ben Bolker [[alternative HTML version deleted]]
It can be done without setting locales using chron:> library(chron) > as.Date(chron("1970-Jan-01", format = "Year-Month-Day"))[1] "1970-01-01" On Wed, Jul 1, 2009 at 10:09 AM, Ben Bolker<bbolker at gmail.com> wrote:> ?Dear r-helpers, > > ?This is a little bit more of a Windows problem than > an R problem, but ... > > ?any idea how to query the *available* locales from > within R (or otherwise) on a Windows system? ?Teaching > in a Spanish-language setting and would like to do > something like > > Sys.setlocale("LC_TIME","en_US") > > (for example so that we can convert dates like > "1970-jan-01" with as.Date(x,"%Y-%b-%d") > > but keep getting reports that this is not honored > by the OS. ?Does anyone have useful pointers? > > ?thanks > ? ?Ben Bolker > > ? ? ? ?[[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. >
Gabor Grothendieck wrote:> It can be done without setting locales using chron: > >> library(chron) >> as.Date(chron("1970-Jan-01", format = "Year-Month-Day")) > [1] "1970-01-01" > > On Wed, Jul 1, 2009 at 10:09 AM, Ben Bolker<bbolker at gmail.com> wrote: >> Dear r-helpers, >> >> This is a little bit more of a Windows problem than >> an R problem, but ... >> >> any idea how to query the *available* locales from >> within R (or otherwise) on a Windows system? Teaching >> in a Spanish-language setting and would like to do >> something like >> >> Sys.setlocale("LC_TIME","en_US")Ben, try Sys.setlocale("LC_TIME", "en") or Sys.setlocale("LC_TIME", "English_United States.1252") Best, Uwe>> (for example so that we can convert dates like >> "1970-jan-01" with as.Date(x,"%Y-%b-%d") >> >> but keep getting reports that this is not honored >> by the OS. Does anyone have useful pointers? >> >> thanks >> Ben Bolker >> >> [[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-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.