Hi
I want to use a function (update) that in its body uses
eval(call, parent.frame())
I would like to use this function in a function that does not contain
the variables referred to in 'call'. Those variables are instead in the
parent.frame() of my function (named 'second' below)
Like this:
a <- 2
evalu <- function(obj) {
call <- obj$call
eval(call, parent.frame())
}
first <- function() {
a <- 3
obj <- list(call=expression(a))
second(obj)
}
second <- function(obj) {
eval(evalu(obj), parent.frame())
}
first() #returns 2, but I want 3.
How do I change 'second' such that the value of 'a' from 'first' is
returned?
--
Regards
Rune Schjellerup Philosof
Ph.d.-studerende, Statistik, IST, SDU
Telefon: 6550 3607
E-mail: [email protected]
Adresse: J.B. Winsløwsvej 9, 5000 Odense C
______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.