[Rd] setGeneric() gives "must supply skeleton" when checking package

Martin Morgan mtmorgan at fhcrc.org
Sun Feb 3 18:41:11 CET 2013


On 02/03/2013 09:36 AM, Martin Morgan wrote:
> On 02/02/2013 02:34 PM, Tim Bergsma wrote:
>> r-devel,
>>
>> In a development version of the CRAN package metrumrg, I write ...
>>
>> require(reshape)
>> setGeneric('cast')
>> setOldClass(c('keyed','data.frame'))
>> setMethod('cast','keyed', function ...)
>>
>> The result is satisfactory when sourcing the code directly, but when
>> checking the package (which has 'reshape' as a dependency in the
>> DESCRIPTION file) I get the following:
>>
>> "Error in setGeneric("cast") : must supply a function skeleton for
>> ???cast???, explicitly or via an existing function."
>
> You haven't mentioned your DESCRIPTION or NAMEPSACE file, but the right thing to
> do is
>
> DESCRIPTION:
>
> Depends: reshape

Should be Imports: reshape


>
> NAMESPACE:
>
> importFrom(reshape, cast)
>
> R/somefile.R:
>
> setGeneric("cast")
>
> Perhaps your current setGeneric is being performed inside the namespace when
> cast is not yet available (e.g., because it has not been imported)?
>
> Martin Morgan
>
>>
>> The help for setGeneric() seems to suggest that no function skeleton is
>> needed  when creating a generic for a function defined in some other
>> package.  I found one or two previous related posts, but no obvious
>> resolution.
>>
>> Comments appreciated,
>>
>> Tim Bergsma, PhD
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the R-devel mailing list