[R] how to modify variables of another frame (but not global)

Meinhard Ploner meinhardploner at gmx.net
Tue Mar 23 12:17:39 CET 2004


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




More information about the R-help mailing list