Displaying 1 result from an estimated 1 matches for "outerfunction".
Did you mean:
enterfunction
2013 Jun 12
2
Functions within functions - environments
...follows:
innerfunction<-function()
{
print(paste(a, " from inner function"))
print(paste(b, " from inner function"))
setwd(wd)
}
middlefunction<-function()
{
b="b"
print(paste(b, " from middle function"))
innerfunction()
}
outerfunction<-function()
{
a="a"
print(paste(a," from outer function"))
middlefunction()
}
outerfunction()
Here, R will tell me that the inner function has no clue what a or b is.
So what I want, is the inner function to recognize a and b.
Any suggestions?
Many thanks!
Ri...