[Rd] restoring LANGUAGE env variable within an R session

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Mon Jun 26 15:38:48 CEST 2023


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



More information about the R-devel mailing list