Hi, this has recently been discussed r-help. Please search the archive
for more details. The short summary is that you need to use assign()
or the <<- assignment operator depending on your exact problem.

Cheers

Henrik Bengtsson
Lund University

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Meinhard
Ploner
> Sent: den 23 mars 2004 12:18
> To: [EMAIL PROTECTED]
> Subject: [R] how to modify variables of another frame (but not
global)
> 
> 
> Hello!
> 
> Maybe "frame" is not the right term in this context.
> I explain my problem by example code:
> 
> fun2 <- function(objName, add) {
>       ## the object "objName" should be increased by "add",
>       ## but the evaluation should be done in the calling 
> function (here: 
> fun1)
>       ##    ...... what's the right code??
> }
> 
> fun1 <- function() {
>       x <- 1
> 
>       fun2("x", 10)           ## should modify "x"
> 
>       ## now x should be 11, but only here and NOT globally!
>       ...
> }
> 
> 
> I would like to appreciate any solution!
> Thanks in advance
> 
> Meinhard Ploner
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list 
> https://www.stat.math.ethz.ch/mailma> n/listinfo/r-help
> PLEASE 
> do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

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

Reply via email to