I am using ifelse to filter from a vector of characters.
file_list=c("a.csv","b.csv","c.csv","d.csv","e.csv","f.csv")
rmd_list=c("c.csv","d.csv","e.csv","f.csv")
input=as.list(c("Tom","Brad"))
RCM=input[[1]]
ifelse(RCM %in% "Tom",file_list[!file_list%in%rmd_list],0)
The output suppose to show "a.csv" and "b.csv"