[R] warning creating an as.array method in a package
Michael Friendly
friendly at yorku.ca
Tue Nov 30 23:43:12 CET 2010
[Env: R 2.11.1, Win Xp, using Eclipse/StatET]
In a package I'm working on, I want to create as.matrix() and as.array()
methods for a particular kind of
object (log odds ratios). These are returned in a loddsratio object as
the $coefficients component,
a vector, but really reflect an underlying (R-1)x(C-1)xstrata array,
whose attributes are contained in other
components.
I define coef, dim and dimnames methods, and then want an as.array method,
## dim methods
dimnames.loddsratio <- function(object, ...) object$dimnames
dim.loddsratio <- function(object, ...) object$dim
coef.loddsratio <- function(object, log = object$log, ...)
if(log) object$coefficients else exp(object$coefficients)
as.array.loddsratio <- function (x, log=x$log, ...)
drop(array(coef(x, log = log), dim = dim(x), dimnames=dimnames(x)))
I believe everything is declared properly in the NAMESPACE file, e.g.,
...
S3method(dim, loddsratio)
S3method(dimnames, loddsratio)
S3method(print, loddsratio)
S3method(vcov, loddsratio)
S3method(as.matrix, loddsratio)
S3method(as.array, loddsratio)
All my tests work correctly when run in the R console, but R CMD check
gives me a perplexing warning:
* checking whether package 'vcdExtra' can be installed ... WARNING
Found the following significant warnings:
Warning: found an S4 version of 'as.array' so it has not been
imported correctly
See 'C:/eclipse/vcdExtra.Rcheck/00install.out' for details.
It's just a warning, so maybe I can ignore it, but I can't figure out
where this might have come from.
Has anyone seen this before? Where might an S4 version of as.array be
found?
--
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