Re: [R] Functions within functions - environments

2013-06-12 Thread William Dunlap
.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Rik Verdonck > Sent: Wednesday, June 12, 2013 10:42 AM > To: r-help@r-project.org > Subject: [R] Functions within functions - environments > >

Re: [R] Functions within functions - environments

2013-06-12 Thread Rui Barradas
Hello, See the help page for parent.frame, and use its argument to go back to the frames of variables 'a' and 'b': innerfunction<-function() { env1 <- parent.frame(1) # for 'b' env2 <- parent.frame(2) # for 'a' print(paste(env2$a, " from inner function")) print(paste(env1$b,

[R] Functions within functions - environments

2013-06-12 Thread Rik Verdonck
Dear list, I have a problem with nested functions and I don't manage to get it solved. I know I should be looking in environments, and I have tried a lot, but it keeps on erroring. An easy version of the problem is as follows: innerfunction<-function() { print(paste(a, " from inner functi