List files in R that do NOT match a pattern

后端 未结 2 2016
感情败类
感情败类 2021-01-03 20:25

R has a function to list files in a directory, which is list.files(). It comes with the optional parameter pattern= to list only files

2条回答
  •  礼貌的吻别
    2021-01-03 20:50

    I think that the simplest (and probably fastest if you include programmer time) approach is to run list.files 2 times, once to list all the files, then the second time with the pattern of files that you do not want, then use the setdiff function to find those file names that are not in the group that you want to exclude.

提交回复
热议问题