Skip to content

Evaluating code in a sandbox

1 message · lederer@trium.de

#
Dear R-Gurus,

is it possible to evaluate foreign R code in such a safe way, that it has
no chance to confuse the global environment?

The follwing does not suffice, because the untrusted code might e.g.
contain a superassignment ("<<-"):

connection <- textConnection(some.untrusted.code)
try(eval(parse(connection), envir=new.env()))
close(connection)


Christian