CRAN NOTE: apparent S3 methods exported but not registered:

1,090 views
Skip to first unread message

Timothy Bates

unread,
Aug 21, 2015, 3:59:22 AM8/21/15
to devtools
Hi,
I created an S3 method to handle getting residuals from MxModel objects.
The package works fine for me, but running check(), i get this NOTE:

* checking S3 generic/method consistency ... NOTE
Found the following apparent S3 methods exported but not registered:
  confint.MxModel residuals.MxModel
See section ‘Registering S3 methods’ in the ‘Writing R Extensions’
manual.

Sure enough, the method is not appearing as an S3 in NAMESPACE. 

Any cues how to fix this?

Here's the core of the oxygen and function:

#' Get residuals from an MxModel
#'
#' Return the \code{\link{residuals}} from an OpenMx RAM model
#'
#' @rdname residuals.MxModel
#' @param object An fitted \code{\link{mxModel}} from which to get residuals
#' @param digits rounding (default = 2)
#' @param suppress smallest deviation to print out (default = NULL = show all)
#' @param ... Optional parameters
#' @return - matrix of residuals
#' @export residuals.MxModel
residuals.MxModel <- function(object, digits = 2, suppress = NULL, ...){
    return("hello"
}

Timothy Bates

unread,
Aug 21, 2015, 5:28:29 AM8/21/15
to devtools
A little additional info: It appears a workaround is to manually edit the namespace file (despite the warning that this is not durable).

S3method(confint,MxModel)
S3method
(residuals,MxModel)

 
My methods then appear in the S3 method list, e.g. item 7 in the list of methods for dispatch of residuals:

methods(residuals)
 
[1] residuals.default*       residuals.glm            residuals.HoltWinters*  
 
[4] residuals.isoreg*        residuals.lm             residuals.loglm*        
 
[7] residuals.MxModel        residuals.nls*           residuals.psych*        
[10] residuals.smooth.spline* residuals.tukeyline*    
see
'?methods' for accessing help and source code



Hadley Wickham

unread,
Aug 21, 2015, 7:48:40 AM8/21/15
to Timothy Bates, devtools
Don't do:

> #' @export residuals.MxModel

Do:

> #' @export

Hadley
> --
> You received this message because you are subscribed to the Google Groups
> "devtools" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rdevtools+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
http://had.co.nz/

Timothy Bates

unread,
Aug 21, 2015, 8:30:20 AM8/21/15
to devtools
many thanks H!. Hope this helps someone else too.

I think the "exports myName" useage crept in when I was trying to get the R to find my custom help pages.
Reply all
Reply to author
Forward
0 new messages