Why not just save your current global environment and reload it after
running the offending code? See ?save.image to save, then rm(list =
ls()) to clear the global environment.

If a program tries to get or assign something to a global environment,
then either you rewrite the program to do otherwise, or you rewrite the
assignment functions, as one cannot silo the global environment like
such without writing it to disk (or another environment).

Robert

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 30, 2005 8:10 PM
To: [email protected]
Subject: [R] Evaluating code in a sandbox



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

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to