On Tue, Mar 19, 2019 at 9:59 AM peter dalgaard <pda...@gmail.com> wrote: [...] > What you need is something like (NB: single quotes!) > > system2("sh", env = c("VAR='Hello World'"), args = c("-c 'echo $VAR'")) > Hello World
Just out of curiosity, do you think it is possible to make this portable, assuming sh is available? On Windows it gives > system2("sh", env = c("VAR='Hello World'"), args = c("-c 'echo $VAR'")) /rtools34/bin/sh: VAR=Hello World: No such file or directory Warning message: running command '"sh" VAR='Hello World' -c 'echo $VAR'' had status 127 G. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel