I have a R function with following header:
getFileNames <- function(sex=NULL,species=NULL,name=NULL){
When I call it like this, all is fine:
getFileNames(sex="F",species="Pan paniscus")
However, I would like to call it with variable filters
like this:
getFileNames(filters)
Now I am trying to figure out how to define filters
. I have tried
filters<-paste("sex=F","species=Pan paniscus",sep=",")
with no success.
The best you can do is to use do.call
:
filters = list(sex="F",species="Pan paniscus")
do.call(getFileNames, filters)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.