[R] Is there an inverse function of Sys.getenv()
Uwe Ligges
ligges at statistik.tu-dortmund.de
Tue May 22 21:33:43 CEST 2012
On 22.05.2012 20:48, Michael wrote:
> Using "Sys.getenv()",
>
> I got a list of 380 environment variables...
>
> Now I open a new R session,
>
> how do I set those environment variables in my new R session using
> "Sys.setenv()"?
>
> There is no batch function for "Sys.setenv()"?
>
> Is there an import/export environment variables function?
>
> Basically I want to export all the environment variables from one R
> session and import them into another R session...
You don't want to do that for all variables, not all of them are related
to R, some related to other software products or even your OS (and hence
perhaps important not to change them).
Anyway, to answer your question:
# get:
envVars <- Sys.getenv()
# set:
do.call(Sys.setenv, as.list(envVars))
Uwe Ligges
> Thank you!
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list