[R] warning creating an as.array method in a package

Michael Friendly friendly at yorku.ca
Thu Dec 2 15:07:21 CET 2010


On 12/2/2010 8:58 AM, Michael Friendly wrote:
> Under ?methods the Note says
>
> Functions can have both S3 and S4 methods, and function showMethods will
> list the S4 methods (possibly none).
>
> Does the warning mean that I cannot (or should not) have an S3 as.array
> method in a package?
> The method works in my context, but the warning will create problems
> when I submit to CRAN, so I would rather avoid it.
>

A little more testing:  Same warning when I load my package, whether or 
not Matrix has been loaded:

 > library(vcdExtra)
Loading required package: vcd
Loading required package: MASS
Loading required package: grid
Loading required package: colorspace
Loading required package: gnm
Warning message:
found an S4 version of ‘as.array’ so it has not been imported correctly
 > showMethods("as.array")
Function: as.array (package base)
x="ANY"
x="Matrix"

But as.array does show up as a method for my class:

 > methods(class="loddsratio")
[1] as.array.loddsratio*      as.data.frame.loddsratio*
[3] as.matrix.loddsratio*     coef.loddsratio*
[5] confint.loddsratio*       dim.loddsratio*
[7] dimnames.loddsratio*      print.loddsratio*
[9] vcov.loddsratio*

    Non-visible functions are asterisked
 >


-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list