I want to list all files in a directory that met certain conditions (date and currency). So with only one condition the argument pattern
in list.files
If you want to preserve your pattern
as a vector (if you are using this in a package function and want to allow the user to specify the pattern as a vector instead of having them use |
or *
), you can set it up like this:
pattern1 = c('20130801','USD')
file.ls <- list.files(path='~/DATA/PiP/Curvas/', pattern=paste0(pattern1, collapse="|"))
This also allows the pattern1
vector to contain as many elements as you want without having to adjust your code.