How to list only certain files in R? -


i have thousands of different files (having same extension .img) in folder called data. if use :

 dir<- list.files ("c:\\users\\data", "*.img", full.names = true) 

it list files have in folder data.

what need list files named as:

 file_yyyymmdd_data.img     (in yyyymmdd varies 10 years) 

any idea or hint appreciated!

try this

files.new = list.files(directory.path, recursive = true, pattern=".img")

where, "directory.path" path directory containing files need read


edited

to more appropriate

files.new = list.files(directory.path, recursive = true, pattern="file_[0-9]{8}_data[.]img$") 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -