function - R: scope of local/global variables -
i have 2 r chunks follows:
getdetails<-function(files){ read.csv(filenames) } filenames<-list.files("data/", pattern=".csv", full.names=t) df<-lapply(filenames, getdetails)
in function, mistake when have mentioned filenames
variable instead of files
, don't error. there way make r warn this?
thanks.
environment(getdetails) = parent.env(environment(getdetails))
way remove global scope. works me. problem is, has done every function write.
Comments
Post a Comment