[Rd] R CMD check does not recognize S4 functions inside other functions?

Giles Hooker gjh27 at cornell.edu
Fri Aug 28 03:12:48 CEST 2009


I am developing a new R package and am now checking it for submission to
CRAN.

The some functions in the package make use of the sparse matrix routines
in the package 'Matrix'.

When these are loaded in R, they create no problems.

However, when running R CMD check, I run into the following error in 
executing the examples in a .rd file:

 >   DD = Matrix(diag(1,200),sparse=TRUE)
 >   tDD = t(DD)
 >
 > fres = FitMatchOpt(coefs=coefs,which=2,pars=pars,proc)
Error in t.default(DD) : argument is not a matrix
Calls: FitMatchOpt -> t -> t.default
Execution halted

The first two lines of the function FitMatchOpt are

   DD = Matrix(diag(1,200),sparse=TRUE)
   tDD = t(DD)

These were fine when given in the examples section of the .rd file 
directly. However, when defined within a function in the package, the 
lines cause an error.

Sparse matrices improve the computational efficiency of the routines I 
am developing and I would like to use them. But I'm not sure how I can 
get around this error.

Many thanks,

Giles Hooker



More information about the R-devel mailing list