[Rd] "could not find function" in R CMD check [solved, but is this an R bug?]
Ross Boylan
ross at biostat.ucsf.edu
Wed Sep 12 21:54:48 CEST 2007
On Wed, 2007-09-12 at 11:31 +0200, Uwe Ligges wrote:
> Perhaps Namespace issues? But no further ideas. You might want to make
> your package available at some URL so that people can look at it and help...
>
> Uwe Ligges
>
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?
>
> Ross Boylan wrote:
> > During R CMD check I get this:
> > ** building package indices ...
> > Error in eval(expr, envir, enclos) : could not find function
> > "readingError"
> > Execution halted
> > ERROR: installing package indices failed
> >
> > The check aborts there. readingError is a function I just added; for
> > reference
> > setClass("readingError", contains="matrix")
> > readingError <- function(...) new("readingError", matrix(...))
> > which is in readingError.R in the project's R subdirectory.
> >
> > Some code in the data directory invokes readingError, and the .Rd file
> > includes \alias{readingError}, \alias{readingError-class},
> > \name{readingError-class} and an example invoking readingError.
> >
> > I'm using R 2.5.1 as packaged for Debian GNU/Linux.
> >
> > Does anyone have an idea what's going wrong here, or how to fix or debug
> > it?
> >
> > The code seems to work OK when I use it from ESS.
More information about the R-devel
mailing list