[R] Issue with match.call

Hadley Wickham hadley at rice.edu
Mon Oct 4 17:08:41 CEST 2010


> RFF<-function(qtype, qOpt,...){}
> i.e., I have two args that are compulsary and the rest are optional. Now when my user passes the function call, I need to see what optional args are defined and process accordingly...what I have so far is..
>
> RFF<-function(qtype, qOpt,...){
>        mc <- match.call(expand.dots=TRUE)
>  }
>
> I need to see what all args have been sent out of
> vec<-c("flag","sep","dec") and define if-else conditions based on whether they have been defined. How do I do this?

I think you'd be much better off defining those as arguments and using
missing(), rather than messing around with match.call (unless there is
a specific reason you need the unevaluated expressions).

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list