Hello, I have a function that looks like

f=function( type=c("dummy,"A","B,"C"), ... ) {
    type<-match.arg(type)
    if (type=="dummy") stop("Please choose a type that is not dummy.")
    ...
}

I put a "dummy" in the list of choices as a mechanism to prevent users
from not specifying a value for "type" when calling the function. My
question is whether there is a better way to achieve it that does not
need "dummy".

Thanks,
Youyi

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to