[R] months not working with local language (weekdays does)
murdoch.duncan at gmail.com
Mon Jun 5 21:37:38 CEST 2017
For what it's worth, I tried setting my Region | Formats setting to
Spanish (Peru) in Windows 10 Control Panel, and got Spanish weekday and
I believe on Windows we use the Microsoft C strftime function to produce
these strings, with the %A (for weekday) or %B (for month) formats. So
this question probably needs to be addressed to Microsoft.
On 05/06/2017 3:21 PM, Rui Barradas wrote:
> This doesn't answer the question, but in portuguese it works as expected.
> > x <- as.Date("2017-06-05")
> > months(x)
>  "junho"
> > weekdays(x)
>  "segunda-feira"
> > sessionInfo()
> R version 3.4.0 (2017-04-21)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
> Matrix products: default
>  LC_COLLATE=Portuguese_Portugal.1252
>  LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
>  LC_TIME=Portuguese_Portugal.1252
> attached base packages:
>  stats graphics grDevices utils datasets methods base
> loaded via a namespace (and not attached):
>  compiler_3.4.0
> Hope this helps,
> Rui Barradas
> Em 05-06-2017 19:14, Omar André Gonzáles Díaz escreveu:
>> I want to reporte some strange behaviour with the "months" function, from
>> base R.
>> When using "months" to extract months from a date column, I'm getting the
>> months in english, when I was expecting months in spanish.
>> When using "weekdays" to extract days of week from a date column, I'm
>> getting the the days in spanish (as expected).
>> My understanding is that both work with local language. What may be
>> My Session Info:
>> R version 3.4.0 (2017-04-21)
>> Platform: x86_64-w64-mingw32/x64 (64-bit)
>> Running under: Windows 7 x64 (build 7601) Service Pack 1
>> Matrix products: default
>>  LC_COLLATE=Spanish_Peru.1252
>>  LC_CTYPE=Spanish_Peru.1252
>>  LC_MONETARY=Spanish_Peru.1252
>>  LC_NUMERIC=C
>>  LC_TIME=Spanish_Peru.1252
>> attached base packages:
>>  stats graphics grDevices utils datasets
>>  methods base
>> other attached packages:
>>  anytime_0.2.2 ggplot2_220.127.116.1100 lubridate_1.6.0
>>  tidyr_0.6.3 rtweet_0.4.4 dplyr_0.5.0
>>  Rfacebook_0.6.16 httpuv_1.3.3 rjson_0.2.15
>>  httr_1.2.1
>> loaded via a namespace (and not attached):
>>  Rcpp_0.12.10 magrittr_1.5 devtools_1.13.2
>>  munsell_0.4.3 colorspace_1.3-2 R6_2.2.0
>>  rlang_0.1 plyr_1.8.4 stringr_1.2.0
>>  tools_3.4.0 grid_3.4.0 gtable_0.2.0
>>  DBI_0.6-1 git2r_0.18.0 withr_1.0.2
>>  openssl_0.9.6 lazyeval_0.2.0 assertthat_0.2.0
>>  digest_0.6.12 tibble_1.3.1 curl_2.6
>>  memoise_1.1.0 labeling_0.3 stringi_1.1.5
>>  compiler_3.4.0 scales_0.4.1 jsonlite_1.5
>> [[alternative HTML version deleted]]
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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 -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help