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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -