Hi all,
I'm trying to come to grips with how to document S4 methods using ROxygen -
mostly following posts such as this: http://tinyurl.com/ae3kdno
I just can't get it to work (this is roxygen2_2.2.2).
I attach an example below which seems parsed properly, but "R CMD
check"
keeps complaining > ...
> Undocumented S4 methods:
> ...
> generic 'set<-' and siglist 'rcfpdsuperclass,character'
> ...
What am I doing wrong?
Thanks for any pointers.
Sincerely, Joh
#' @title set<-
#' @description Blabla
#' @details Blabla
#' @param object An object of class \code{\link{rcfpdsuperclass}} (or a
#' class inheriting from it).
#' @param slot \code{\link{character}} object with the slot name to be
#' accessed.
#' @param value Content replacing whatever \code{slot} in \code{object}
#' currently holds.
#' @return Returns an object of class \code{\link{rcfpdsuperclass}} with the
#' appropriate replacement.
#' @seealso \code{\link{rcfpdsuperclass}},\code{\link{get}}
#' @export
#' @docType methods
#' @rdname set-methods
#' @author Johannes Graumann
#' @keywords methods manip
#' @examples
#' rs <- new("rcfpdsuperclass")
#' str(rs)
#' get(rs,"RcfpdVersion")
#' # Works
#' set(rs,"RcfpdVersion") <- "4"
#' get(rs,"RcfpdVersion")
#' \dontrun{
#' # Fails due to replacement not being of class "character"
#' set(rs,"RcfpdVersion") <- 4
#' }
setGeneric("set<-",function(object, slot, value)
standardGeneric("set<-"))
#' @rdname set-methods
#' @name set-methods
#' @aliases set<-,rcfpdsuperclass,character,rcfpdsuperclass-
method,character-method
setReplaceMethod(
"set",
signature = signature(object =
"rcfpdsuperclass",slot="character"),
definition = function(object,slot,value){
if(getSlots(class(object))[slot] == "RcfpdStoredObject"){
slot(object,slot) <- storeObject(value)
} else {
slot(object,slot) <- value
}
invisible(validObject(object))
return(object)
})