What is a reliable way of getting allowed locale names in R? What is a reliable way of getting allowed locale names in R? r r

What is a reliable way of getting allowed locale names in R?


In answer to your first question, here's the output on my Mac:

> locales <- system("locale -a", intern = TRUE)> library(stringr)> unique(str_split_fixed(locales, "\\.", 2)[, 1])  [1] "af_ZA" "am_ET" "be_BY" "bg_BG" "ca_ES" "cs_CZ" "da_DK" "de_AT" "de_CH"[10] "de_DE" "el_GR" "en_AU" "en_CA" "en_GB" "en_IE" "en_NZ" "en_US" "es_ES"[19] "et_EE" "eu_ES" "fi_FI" "fr_BE" "fr_CA" "fr_CH" "fr_FR" "he_IL" "hi_IN"[28] "hr_HR" "hu_HU" "hy_AM" "is_IS" "it_CH" "it_IT" "ja_JP" "kk_KZ" "ko_KR"[37] "lt_LT" "nl_BE" "nl_NL" "no_NO" "pl_PL" "pt_BR" "pt_PT" "ro_RO" "ru_RU"[46] "sk_SK" "sl_SI" "sr_YU" "sv_SE" "tr_TR" "uk_UA" "zh_CN" "zh_HK" "zh_TW"[55] "C"     "POSIX"

I'm not sure what I'm expecting to see with Sys.setlocale() but it doesn't throw any errors:

> Sys.setlocale(locale="he_IL")[1] "he_IL/he_IL/he_IL/C/he_IL/en_AU.UTF-8"> Sys.getlocale()[1] "he_IL/he_IL/he_IL/C/he_IL/en_AU.UTF-8"


Thanks all. I went to the URL that Richie suggested, http://msdn.microsoft.com/en-us/library/dd318693.aspx, and tried LANG_BELARUSIAN in windows. That didn't work, so I lopped off the "LANG_" and included "BELARUSIAN" by itself. Worked fine.

> bk.date1

[1] "Ma 2012 august 14 11:28:30 "

ymd_hms(bk.date1, locale = "BELARUSIAN") [1] "2012-08-14 11:28:30 UTC"