1

roxygen2 を使用して S4 クラスのドキュメント化に苦労した後、一歩下がってpackage.skeleton、 、promptClass、およびを使用して最小限の例を作成することにしましたpromptMethod

私の問題は、R CMD check「文書化されていないコードオブジェクト」についての警告が表示されることですが、それらを適切に文書化したと思います。

私が今持っているファイルは次のとおりです。

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}

および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}

パッケージのドキュメント ファイルもありますが、ここでは関係ないと思います。

R CMD check与えます:

* 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.

私はこれらのセクションを参照しましたが、これらから得たのは、少なくとも へのエイリアスが必要であるということですgeneric,signature-list-method。この場合alias{testMethod,testClass-method}、promtMethod の呼び出しによってドキュメント ファイルに自動的に配置されます (クラスからコメントアウトしました)。 .Rd ファイルが重複しているため)。

この警告を取り除くには、.Rd ファイルで何を変更する必要がありますか?

4

1 に答える 1