Skip to content

Local error for month/weekday label (spanish, french, portuguese, ...) #1183

@dominicroye

Description

@dominicroye

When I try to get the month or weekday label in an other language than English I get an invalid length factor.

> month(ymd("2005-07-05"), label = T, local = "en")
[1] Jul
Levels: Jan < Feb < Mar < Apr < May < Jun < Jul < Aug < Sep < Oct < Nov < Dec

> month(ymd("2005-07-05"), label = T, local = "es")
Error in factor(x, ..., ordered = TRUE): 
  'labels'  invalid; length 11 must be either 1 or 12
> sessionInfo()
R version 4.4.2 (2024-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default


locale:
[1] LC_COLLATE=Spanish_Spain.utf8  LC_CTYPE=Spanish_Spain.utf8    LC_MONETARY=Spanish_Spain.utf8 LC_NUMERIC=C                  
[5] LC_TIME=Spanish_Spain.1252    

time zone: Europe/Madrid
tzcode source: internal

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

other attached packages:
 [1] cowplot_1.1.3       janitor_2.2.1       geomtextpath_0.1.5  countrycode_1.6.0   readxl_1.4.3        knitr_1.49         
 [7] ggthemes_5.1.0      colorspace_2.1-1    fs_1.6.5            ggnewscale_0.5.1    ggtext_0.1.2        patchwork_1.3.0    
[13] scales_1.3.0        lubridate_1.9.4     forcats_1.0.0       stringr_1.5.1       dplyr_1.1.4         purrr_1.0.4        
[19] readr_2.1.5         tidyr_1.3.1         tibble_3.2.1        tidyverse_2.0.0     legendry_0.2.0.9000 ggplot2_3.5.1.9000 

loaded via a namespace (and not attached):
 [1] gtable_0.3.6         xfun_0.51            lattice_0.22-6       tzdb_0.4.0           vctrs_0.6.5          tools_4.4.2         
 [7] generics_0.1.3       parallel_4.4.2       pkgconfig_2.0.3      Matrix_1.7-1         RColorBrewer_1.1-3   lifecycle_1.0.4     
[13] compiler_4.4.2       farver_2.1.2         textshaping_1.0.0    munsell_0.5.1        snakecase_0.11.1     htmltools_0.5.8.1   
[19] pillar_1.10.1        crayon_1.5.3         rsconnect_1.3.4      magick_2.8.5         nlme_3.1-166         commonmark_1.9.2    
[25] digest_0.6.37        tidyselect_1.2.1     stringi_1.8.4        labeling_0.4.3       splines_4.4.2        fastmap_1.2.0       
[31] grid_4.4.2           cli_3.6.4            magrittr_2.0.3       utf8_1.2.4           withr_3.0.2          bit64_4.6.0-1       
[37] timechange_0.3.0     rmarkdown_2.29       bit_4.5.0.1          cellranger_1.1.0     ragg_1.3.3           zoo_1.8-13          
[43] png_0.1-8            hms_1.1.3            evaluate_1.0.3       viridisLite_0.4.2    markdown_1.13        mgcv_1.9-1          
[49] rlang_1.1.5          gridtext_0.1.5       Rcpp_1.0.14          glue_1.8.0           xml2_1.3.6           palmerpenguins_0.1.1
[55] rstudioapi_0.17.1    vroom_1.6.5          R6_2.6.1             systemfonts_1.2.1   

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions