On Nov 30, 2010, at 5:43 PM, Michael Friendly wrote:
[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?
Have you looked in the ".out" file in which you were told there were
details?
I'm guessing from this behavior on my system that it may be Matrix.
> showMethods(as.array)
Function: as.array (package base)
x="ANY"
x="Matrix"
--
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.