[Rd] method using several (and different) arguments in turn

From: <james.foadi_at_diamond.ac.uk>
Date: Tue, 14 Feb 2012 16:43:03 +0000


Dear R-developers community, I have the following generic:

setGeneric(

                   name="newsample",
                   def=function(x,y,z,a,b,c,...){standardGeneric("newsample")}

And I can build several methods for this generic. One useful thing is to use "newsample" with only one of the 6 arguments listed. At the moment this is what I do:

setMethod(

                   f="newsample",
                   signature=c("missing","missing","numeric","missing","missing","missing"),
                   function(x,y,z,a,b,c,...)
                   {

..............................
..............................
} )

This would be used when the single argument is z:

newsample(z=12.5)

To use newsample with another argument (say x) I should implement the same as before, but with signature c("numeric","missing","missing","missing","missing","missing"). Is there another shorter and easier way to do this?

J

-- 
This e-mail and any attachments may contain confidential...{{dropped:8}}

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 14 Feb 2012 - 16:51:51 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 14 Feb 2012 - 17:20:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive