> graphit<-function(x,var,type,subset=NA,...){ > if(!is.na(subset[1])) x<-subset(x,subset) > do.call(type,list(x=x[[var]],...)) > }
A further slight simplification is possible using the fact that subset(x, TRUE) returns x unchanged: graphit<-function(x,var,type,subset=TRUE,...){ x<-subset(x,subset) do.call(type,list(x=x[[var]],...)) } S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ 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.