with_language() not working in RStudio IDE for Windows 10
Closed this issue · 2 comments
cderv commented
This is an odd behavior found while looking at r-lib/testthat#1534
When I run this
withr::local_language("en", mean[[1]])
withr::local_language("fr", mean[[1]])
withr::local_language("es", mean[[1]])
I get all result still in English
> withr::local_language("en", mean[[1]])
Error in mean[[1]] : object of type 'closure' is not subsettable
> withr::local_language("fr", mean[[1]])
Error in mean[[1]] : object of type 'closure' is not subsettable
> withr::local_language("es", mean[[1]])
Error in mean[[1]] : object of type 'closure' is not subsettable
I found out that this could be related to my installation of RStudio because when I run on R Gui I got it right
> withr::local_language("en", mean[[1]])
Error in mean[[1]] : object of type 'closure' is not subsettable
> withr::local_language("fr", mean[[1]])
Erreur dans mean[[1]] : objet de type 'closure' non indiçable
> withr::local_language("es", mean[[1]])
Error in mean[[1]] : objeto de tipo 'closure' no es subconjunto
Session Info
> sessioninfo::session_info()
- Session info --------------------------------------------------------------------------
setting value
version R version 4.1.2 (2021-11-01)
os Windows 10 x64 (build 19043)
system x86_64, mingw32
ui RStudio
language es
collate French_France.1252
ctype French_France.1252
tz Europe/Paris
date 2022-01-05
rstudio 2022.02.0-daily+345 Prairie Trillium (desktop)
pandoc 2.16.2 @ C:\\Users\\chris\\DOCUME~1\\DEV_R\\QUARTO~2\\package\\dist\\bin\\pandoc.exe
- Packages ------------------------------------------------------------------------------
package * version date (UTC) lib source
askpass 1.1 2019-01-13 [1] CRAN (R 4.1.0)
cli 3.1.0 2021-10-27 [1] CRAN (R 4.1.2)
credentials 1.3.2 2021-11-29 [1] CRAN (R 4.1.1)
curl 4.3.2 2021-06-23 [1] CRAN (R 4.1.0)
jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.1.0)
openssl 1.4.6 2021-12-19 [1] CRAN (R 4.1.1)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.2)
sys 3.4 2020-07-23 [1] CRAN (R 4.1.0)
withr 2.4.3.9000 2022-01-05 [1] Github (r-lib/withr@678a9d4)
[1] C:/Users/chris/Documents/R/win-library/4.1
[2] C:/Program Files/R/R-4.1.2/library
-----------------------------------------------------------------------------------------
RStudio version is 2022.02.0-daily+345
but this also happens within last release 2021.09.1+372
.
Not sure if this is an RStudio bug or not. 🤔
gaborcsardi commented
It does not seem like a withr bug, because in RStudio on Windows I get
> Sys.setenv(LANGUAGE="fr")
> mean[[1]]
Error in mean[[1]] : object of type 'closure' is not subsettable
Whereas in Rterm with the same R installation:
> Sys.setenv(LANGUAGE="fr")
> mean[[1]]
Erreur dans mean[[1]] : objet de type 'closure' non indiçable
cderv commented
Ok thanks for confirming. I have opened the issue in RStudio repo if you want to close this here.