Dear all, I'm writing a package and I would like to reuse the residuals() function. When I use a function which calls the redefined residuals (for my custom class) I get an error (see below). It looks like the wrong method is used. The strange this is, that when it execute the code manually it get no error.
Any suggestions? Best regards, Thierry The entire source code is at svn://scm.r-forge.r-project.org/svnroot/aflp The code with the error. > normalise(dummy) Error in object$na.action : $ operator not defined for this S4 class > traceback() 5: naresid(object$na.action, object$residuals) at normalise.R#30 4: residuals.default(outliers(data)) at normalise.R#30 3: residuals(outliers(data)) at normalise.R#30 2: nrow(residuals(outliers(data))) at normalise.R#30 1: normalise(dummy) #This works fine > data <- dummy > nrow(residuals(outliers(data))) [1] 0 NAMESPACE importFrom(stats, residuals, resid, hclust, princomp) exportPattern(".") METHODS setMethod("residuals", signature(object = "AFLP.outlier"), function(object, ...){ object@Residual } ) setMethod("resid", signature(object = "AFLP.outlier"), function(object, ...){ object@Residual } ) ---------------------------------------------------------------------------- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel