After struggling with documenting a S4 class with roxygen2, I decided to take a step back and create a minimum example using package.skeleton
, promptClass
, and promptMethod
.
My problem is that R CMD check
still gives a warning about "undocumented code objects", although I think that I have documented them properly.
The files I have now are:
testClass.R:
setClass("testClass",
slots = c(a = "numeric"),
prototype = prototype( a = 0 ),
validity = function(object) return(TRUE))
setGeneric(name = "testMethod",
def = function(object, ...) standardGeneric("testMethod") )
setMethod(f = "testMethod", signature = "testClass",
definition=function(object, x)
{
cat("testMethod:",x,"\n")
invisible(object)
}
)
testClass-class.Rd
\name{testClass-class}
\Rdversion{1.1}
\docType{class}
\alias{testClass-class}
%%\alias{testMethod,testClass-method}
\title{Class \code{"testClass"}}
\description{bla bla}
\section{Objects from the Class}{bla bla}
\section{Slots}{\describe{\item{\code{a}:}{Object of class \code{"numeric"} ~~ }}}
\section{Methods}{\describe{\item{testMethod}{\code{signature(object = "testClass")}: ... }}}
\keyword{classes}
and testMethod.Rd
\name{testMethod-methods}
\docType{methods}
\alias{testMethod-methods}
\alias{testMethod,testClass-method}
\title{ ~~ Methods for Function \code{testMethod} ~~}
\description{blabla}
\section{Methods}{
\describe{\item{\code{signature(object = "testClass")}}{blabla}}}
\keyword{methods}
There is also a package documentation file, but I think it is not relevant here.
R CMD check
gives:
* checking for missing documentation entries ... WARNING
Undocumented code objects:
‘testMethod’
All user-level objects in a package should have documentation entries.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
I have consulted these sections, and what I took from these is that I needed at least an alias to generic,signature-list-method
, which in this case would be alias{testMethod,testClass-method}
which was placed in the documentation file automatically by my call of promtMethod (I have commented it out from the class .Rd file because it was duplicated there).
What do I need to change in the .Rd file to get rid of this warning?
In the meanwhile, I figured out the problem. It seems that I also needed to ass \alias{testMethod}
to the .Rd file. I find it strange, however, that the file generated by promptMethod
did not include this alias.