[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:

From

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

to

>* 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

to

pd$ VAR="foo"; echo $VAR


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

luke

	[[alternative HTML version deleted]]



More information about the R-devel mailing list