Re: [Rd] Clarification on generic functions and methods

From: Doran, Harold <HDoran_at_air.org>
Date: Wed, 11 Nov 2009 16:06:18 -0500


Hi Ken:

Well, I'm quite pleased with a solution I found. The t.test method and its .Rd file showed me that I can export only the generic method, use \alias{jml2.default} and \alias{jml2.formula} in the .Rd file for jml2, and then use \method{jml2}{default}{args} and \method{jml2}{formula}{args}.

Using this, I was able to build the package in both windows and Ubuntu without error.

> -----Original Message-----
> From: r-devel-bounces_at_r-project.org
> [mailto:r-devel-bounces_at_r-project.org] On Behalf Of Ken Knoblauch
> Sent: Wednesday, November 11, 2009 3:58 PM
> To: r-devel_at_stat.math.ethz.ch
> Subject: Re: [Rd] Clarification on generic functions and methods
>
> Doran, Harold <HDoran <at> air.org> writes:
> >
> > Thank you, Henrik. This actually doesn't work when I build the
> > package,
> which may only require a slight
> > modification to what I'm doing now. First, I create a NAMESPACE as:
> >
> > ### NAMESPACE FILE CONTENTS
> > export(jml2)
> > S3method(jml2, fit)
> > S3method(jml2, default)
> > S3method(jml2, formula)
> > S3method(print, jml)
> > S3method(summary, jml)
> > S3method(print, summary.jml)
> >
> > So, only the generic function (jml) is exported.
> >
> > Now, I do as you suggest below for the generic function,
> but keep all
> > others
> as they were previously. That
> > creates a situation where jml.formula, jml.default, and jml have
> > different
> arguments.
> >
> > Now, in the .Rd file for the jml function I want the user
> to see the
> > usage for
> the jml.formula method, which
> > obviously has more args than "...". So, the .Rd file is
> structured as
> (for testing purposes only):
>
> How about if you document the default method as well as the
> generic method in your man page. See ?lag for an example,
> and I've come across several others recently.
>
> HTH,
>
> Ken
>
> --
> Ken Knoblauch
> Inserm U846
> Stem-cell and Brain Research Institute
> Department of Integrative Neurosciences
> 18 avenue du Doyen LÚpine
> 69500 Bron
> France
> tel: +33 (0)4 72 91 34 77
> fax: +33 (0)4 72 91 34 61
> portable: +33 (0)6 84 10 64 10
> http://www.sbri.fr/members/kenneth-knoblauch.html
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 11 Nov 2009 - 21:09:20 GMT

This archive was generated by hypermail 2.2.0 : Wed 11 Nov 2009 - 22:50:24 GMT