[Rd] restoring LANGUAGE env variable within an R session

Eric Berger er|cjberger @end|ng |rom gm@||@com
Mon Jun 26 15:41:36 CEST 2023


There is also some inconsistency.
Even though sqrt(-1) returns the warning/error about NaNs in German
after setting the language to Spanish, if you give the command
> messages()
it will respond in Spanish.



On Mon, Jun 26, 2023 at 4:39 PM Dirk Eddelbuettel <edd using debian.org> wrote:
>
>
> Ben,
>
> POSIX level / glibc level variables are set at process start and AGAIK cannot
> really be altered after start.  They clearly work when set _before_ calling sqrt(-1):
>
>     $ LANGUAGE=es Rscript -e 'sqrt(-1)'
>     [1] NaN
>     Warning message:
>     In sqrt(-1) : Se han producido NaNs
>     $ LANGUAGE=de Rscript -e 'sqrt(-1)'
>     [1] NaN
>     Warnmeldung:
>     In sqrt(-1) : NaNs wurden erzeugt
>     $
>
> I think the `callr` package can help you with this use from with R by
> effectively spawning a new process for you. Or, lower-level, you can call
> `system()` or `system2()` yourself and take care of the setup.
>
> Cheers, Dirk
>
> --
> dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list