[R] R CMD check: problems possibly from mapply?
Ulrike Grömping
groemping at tfh-berlin.de
Tue Mar 14 15:25:05 CET 2006
Dear expeRts,
I am trying to wrap up a package "utilities" (for my internal use). After
adding a function datNAtreat that uses mapply, R CMD check gives WARNINGs
for "S3 generic/method consistency", "checking replacement functions"
and "checking foreign function calls", all of which are accompanied by the
following error message:
Error in .try_quietly ....: Error: unable to load R code in
package 'utilities'
Execution halted
Additionally, I get an ERROR for missing documentation entries (which I don't
understand, because this function like all others is documented).
R CMD check works without problems when omitting this function. The function
itself also works when running the code outside the package. I have now
stripped it down (omitted error controls etc., it still works), and can only
guess that the R CMD check problems have to do with mapply (with which I am
not all that familiar).
I include the code (not reproducible) in case someone has an idea what I can
do to make this function packageable. (The function as.factora is defined
elsewhere in the package and takes the arguments x (a column of a data
frame), na.level and na.show (a logical).):
##########################################################
datNAtreat <- function(x, na.levels=NULL, na.show=FALSE) {
if (!is.data.frame(x)) x <- as.data.frame(x)
names <- colnames(x)
if (is.null(names)) names <- paste("x",1:ncol(x),sep="")
x <- as.data.frame(mapply(as.factora, x, na.level=na.levels,
MoreArgs=list(na.show = na.show), SIMPLIFY=FALSE))
colnames(x) <- names
return(x)
}
############################################################
Any suggestions are appreciated, as I have no idea where else to look.
With kind regards, Ulrike
More information about the R-help
mailing list