Sorry, just pressing the send button brought the solution :-)
The problem has nothing to do with any programming issues, but rather with
confusion about directories to use R CMD from.
Regards, Ulrike
---------- Forwarded Message -----------
From: "Ulrike Gr?mping" <groemp at tfh-berlin.de>
To: r-help at stat.math.ethz.ch
Sent: Tue, 14 Mar 2006 15:25:05 +0100
Subject: R CMD check: problems possibly from mapply?
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
------- End of Forwarded Message -------
******************************
Prof. Dr. Ulrike Gr?mping
Fachbereich II
TFH Berlin
Luxemburger Str. 10
13353 Berlin
mail: groemping at tfh-berlin.de
www: www.tfh-berlin.de/~groemp/