Try this: nbr <- 30 lapply(body(x), eval)[[grep("y1", body(x))]]
On Fri, Feb 19, 2010 at 3:39 PM, threshold <r.kozar...@gmail.com> wrote: > > Hi, say I got the function: >> x=function(nbr){y<-rnorm(nbr);y1 <- mean(y);plot(y)} > > how can I retrieve value of y1, when I need it. > > I don't want: >> x=function(nbr){y<-rnorm(nbr);y1 <<- mean(y);plot(y)} >> y1 > > I want someting like: > "x$y1" and then I get the value > > Many thanks, robert > > > > > > -- > View this message in context: > http://n4.nabble.com/retrieve-from-function-tp1561972p1561972.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ R-help@r-project.org 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.