我用li <- list.files(path, full.names = F, include.dirs = F)
。令我惊讶的是,其中li
也包含文件夹。我以为可以使用关闭该功能include.dirs = F
。我错了吗?
我正在Windows上使用R版本3.2.2(2015-08-14)。
@Christoph,如果您引用R提供的帮助,则写的语句是
include.dirs: logical. Should subdirectory names be included in recursive listings? (They always are in non-recursive ones).
。
我想强调一下这个术语:(它们总是非递归的)。
就像@RichardTelford正确说的那样,默认情况下,的值recursive = FALSE
。
如果您确实想要执行此任务,则可以尝试以下代码:
setdiff(list.files(path,full.names=T),list.dirs(path,recursive=F))
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句