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.