I execute:
reprex({
# inheriting everything from local system
# for Jenny, this means English
"a" / 2
1:3 == c(1:2, 5)
format(as.Date(c("2019-01-01", "2019-02-01")), "%d %B %Y")
})
which yields:
# inheriting everything from local system
# for Jenny, this means English
"a" / 2
#> Error in "a"/2: non-numeric argument to binary operator
1:3 == c(1:2, 5)
#> [1] TRUE TRUE FALSE
format(as.Date(c("2019-01-01", "2019-02-01")), "%d %B %Y")
#> [1] "01 January 2019" "01 February 2019"
I execute:
reprex_locale({
# the LANGUAGE env var affects messages (and that is all it affects here)
# in reprex_locale(), that is controlled by the `language` argument
"a" / 2
1:3 == c(1:2, 5)
format(as.Date(c("2019-01-01", "2019-02-01")), "%d %B %Y")
}, language = "fr")
which yields:
# the LANGUAGE env var affects messages (and that is all it affects here)
# in reprex_locale(), that is controlled by the `language` argument
"a" / 2
#> Error in "a"/2: argument non numérique pour un opérateur binaire
1:3 == c(1:2, 5)
#> [1] TRUE TRUE FALSE
format(as.Date(c("2019-01-01", "2019-02-01")), "%d %B %Y")
#> [1] "01 January 2019" "01 February 2019"
I execute:
reprex_locale({
# the LC_TIME component of the locale affects, e.g., the character strings
# associated with the months
# in reprex_locale(), locale components can be set with the `locale` argument
"a" / 2
1:3 == c(1:2, 5)
format(as.Date(c("2019-01-01", "2019-02-01")), "%d %B %Y")
}, language = "fr", locale = c(LC_TIME = "fr_FR"))
which yields:
# the LC_TIME component of the locale affects, e.g., the character strings
# associated with the months
# in reprex_locale(), locale components can be set with the `locale` argument
"a" / 2
#> Error in "a"/2: argument non numérique pour un opérateur binaire
1:3 == c(1:2, 5)
#> [1] TRUE TRUE FALSE
format(as.Date(c("2019-01-01", "2019-02-01")), "%d %B %Y")
#> [1] "01 janvier 2019" "01 février 2019"
Created on 2021-02-13 by the reprex package (v1.0.0.9000)
https://reprex.tidyverse.org/reference/reprex_locale.html
https://github.com/tidyverse/reprex/blob/master/R/reprex-locale.R