I am new to R
and try to understand the environments. According to that question an environment is called for each function call. Hence, I expected that search()
shows me that new environment created by a new function call. Indeed, it is not appearing in the demo code bellow and also the variable x
, which should be in the parent environment, is not found.
a<-function(){ # should create a further environment
print(search()) # does not include any "new" environment, just global and packages
#print(x) #not working but should be in the parent environment
}
b<-function(){ #should create an environment
x<-2
a()
}
b()