foo <- function(y) assign(deparse(substitute(y)), y^2, parent.frame()) assigns to the calling frame. Or you could put the required frame as a second argument.
> -----Original Message----- > From: Barry Rowlingson [mailto:[EMAIL PROTECTED] > Cutting to what I think was the gist of the original poster's > question, > can I write a function, foo, that does this: > > > x <- 3 > > foo(x) > > x > [1] 9 > > for any x, in any situation? I'm guessing its doable, but ugly... > > > Baz > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 644449 Fax: +44 (0) 1379 644445 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help