Skip to content
Prev 26108 / 63424 Next

"could not find function" in R CMD check [solved, but is this an R bug?]

On Wed, 2007-09-12 at 11:31 +0200, Uwe Ligges wrote:
Thanks.  The problem lay elsewhere.  I was able to fix it by adding 
library(mspath)
to the top of the .R file in data/ that defined some data using the
package's functions  In other words
-----------------------------------------------
library(mspath)
### from various papers on errors in reading fibrosis scores
rousselet.jr <- readingError(c(.91, .09, 0, 0, 0,
                               .11, .78, .11, 0, 0,
                               0, .17, .75, .08, 0,
                               0, .06, .44, .50, 0,
                               0, 0, 0, .07, .93),
                             byrow=TRUE, nrow=5, ncol=5)
-----------------------------------------------------
works as data/readingErrorData.R, but without the library() call I  get
the error shown in my original message (see below).  readingError() is a
function defined in my package.

Does any of this inndicate a bug or undesirable feature in R?

First, it seems a little odd that I need to include loading the library
in data that is defined in the same library.  I think I've noticed
similar behavior in other places, maybe the code snippets that accompany
the documentation pages (that is, one needs library(mypackage) in order
for the snippets to check out).

Second, should R CMD check fail so completely and opaquely in this
situation?