Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个 R 块,如下所示:
getDetails<-function(files){ read.csv(filenames) } filenames<-list.files("data/", pattern=".csv", full.names=T) df<-lapply(filenames, getDetails)
在函数中,即使我提到filenames了 variable 而不是files,我也没有得到任何错误。有什么方法可以让 R 对此发出警告吗?
filenames
files
谢谢。
environment(getDetails) = parent.env(environment(getDetails))是一种删除全局范围的方法。这对我有用。唯一的问题是,我编写的每个函数都必须这样做。
environment(getDetails) = parent.env(environment(getDetails))