Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

search - R list files with multiple conditions

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 works well:

    file.ls <- list.files(path='~/DATA/PiP/Curvas/',pattern='20130801')

For multiple conditions I've tried:

    file.ls <- list.files(path='~/DATA/PiP/Curvas/',pattern=c('20130801','USD'))

But had the same result as the first one. Is there a way to have multiple criteria in pattern argument of list.files?

question from:https://stackoverflow.com/questions/18028225/r-list-files-with-multiple-conditions

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
file.ls <- list.files(path='~/DATA/PiP/Curvas/',pattern="20130801|USD")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...