[Rd] Possibly broken system2 env-option

l o |ukemo|@on @end|ng |rom gm@||@com
Wed Mar 20 01:00:21 CET 2019

Studying Professor Dalgaard's code a bit, here is a little hack that
returns the desired result on Unix-alikes:


>* system2("echo", env = c("VAR='Hello World'"), args = c("$VAR"))*


>* system2("echo", env = c("VAR='Hello World';"), args = c("$VAR"))*
Hello World

That is, adding the semi-colon effectively transforms

pd$ VAR="foo" echo $VAR


pd$ VAR="foo"; echo $VAR

Maybe this doesn't apply to more complicated situations,though.


	[[alternative HTML version deleted]]

More information about the R-devel mailing list