[R] months not working with local language (weekdays does)

Rui Barradas ruipbarradas at sapo.pt
Mon Jun 5 21:21:09 CEST 2017


Hello,

This doesn't answer the question, but in portuguese it works as expected.

 > x <- as.Date("2017-06-05")
 > months(x)
[1] "junho"
 > weekdays(x)
[1] "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

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 
LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C 

[5] LC_TIME=Portuguese_Portugal.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.0

Hope this helps,

Rui Barradas

Em 05-06-2017 19:14, Omar André Gonzáles Díaz escreveu:
> Hi,
>
> 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
> happening?
>
>
> 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
>
> locale:
> [1] LC_COLLATE=Spanish_Peru.1252
> [2] LC_CTYPE=Spanish_Peru.1252
> [3] LC_MONETARY=Spanish_Peru.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=Spanish_Peru.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets
> [6] methods   base
>
> other attached packages:
>   [1] anytime_0.2.2      ggplot2_2.2.1.9000 lubridate_1.6.0
>   [4] tidyr_0.6.3        rtweet_0.4.4       dplyr_0.5.0
>   [7] Rfacebook_0.6.16   httpuv_1.3.3       rjson_0.2.15
> [10] httr_1.2.1
>
> loaded via a namespace (and not attached):
>   [1] Rcpp_0.12.10     magrittr_1.5     devtools_1.13.2
>   [4] munsell_0.4.3    colorspace_1.3-2 R6_2.2.0
>   [7] rlang_0.1        plyr_1.8.4       stringr_1.2.0
> [10] tools_3.4.0      grid_3.4.0       gtable_0.2.0
> [13] DBI_0.6-1        git2r_0.18.0     withr_1.0.2
> [16] openssl_0.9.6    lazyeval_0.2.0   assertthat_0.2.0
> [19] digest_0.6.12    tibble_1.3.1     curl_2.6
> [22] memoise_1.1.0    labeling_0.3     stringi_1.1.5
> [25] 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
> 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.
>



More information about the R-help mailing list