From maechler at stat.math.ethz.ch  Tue Oct 18 11:51:33 2005
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Tue, 18 Oct 2005 11:51:33 +0200
Subject: [Rd] Documenting newly created generic versions of non-generic
	base	R	functions
In-Reply-To: <1128961782.17225.33.camel@gsimpson.geog.ucl.ac.uk>
References: <1128961782.17225.33.camel@gsimpson.geog.ucl.ac.uk>
Message-ID: <17236.50597.119877.624606@stat.math.ethz.ch>

>>>>> "GS" == Gavin Simpson <gavin.simpson at ucl.ac.uk>
>>>>>     on Mon, 10 Oct 2005 17:29:42 +0100 writes:

    GS> Hi,
    GS> Following the Writing R Extensions manual, I created a method for the
    GS> cor function. As cor is not a generic, I followed the advice of section
    GS> 6.1 of the same manual and did the following:

    GS> cor <- function(x, ...) UseMethod("cor")
    GS> cor.default <- stats::cor
    GS> cor.symcoca <- function{ some code }

    GS> I used package.skeleton to create the basic set-up of my package,
    GS> containing the above functions.

    GS> Do I need to provide a .Rd file for cor and cor.default? - seeing as
    GS> cor.default is cor currently.

    GS> What is the best way to handle documenting functions produced using the
    GS> above hi-jack methodology?

I'd probably write one help page, mainly for the "symcoca"
method, but also with

\alias{cor.default}
\alias{cor.symcoca}

and
\usage{
\method{cor}{symcoca}(..........)
}

and would mention 'cor.default' and your redifinition of cor,
also \code{\link[stats]{cor}}
in the \description{...} or \details{} and/or other appropriate
places.

Regards,
Martin



[Rd] Documenting newly created generic versions of non-generic base R functions
Martin Maechler