Dear List, I am making a list of all the files in a folder and I want to exclude one file called "proj.current". This is the 31st file in a folder. Currently I use the command: tdirs <- list.files(pattern="proj.")[-31] However I would like to exclude it based on its name and not the position. Any advice would be useful. Thanks, Daisy Daisy Englert Duursma Room E8C156 Dept. Biological Sciences Macquarie University NSW 2109 Australia
excluding on element from a list
2 messages · Daisy Englert Duursma, Jim Lemon
On 05/24/2010 05:40 PM, Daisy Englert Duursma wrote:
Dear List, I am making a list of all the files in a folder and I want to exclude one file called "proj.current". This is the 31st file in a folder. Currently I use the command: tdirs<- list.files(pattern="proj.")[-31] However I would like to exclude it based on its name and not the position.
Hi Daisy, I think that: file_list<-list.files(pattern="proj[.]") tdirs<-file_list[!as.logical(match(file_list,"proj.current",0))] should do the trick. Jim