check
Roxygenで代入関数に問題があります。二value
がどこから来ている私は理解していない代入関数の文書化に失敗するR CMD CHECK
* checking for code/documentation mismatches ... WARNING
Codoc mismatches from documentation object 'IDs':
IDs<-
Code: function(x, value)
Docs: function(x, value, value)
IDs<-.SpatialPolygonsDataFrame
Code: function(x, value)
Docs: function(x, value, value)
:
#' Get sp feature IDs
#' @aliases IDs IDs.default IDs.SpatialPolygonsDataFrame IDs<- IDs<-.SpatialPolygonsDataFrame
#' @param x The object to get the IDs from or assign to
#' @param value The character vector to assign to the IDs
#' @param \dots Pass-alongs
#' @author Ari B. Friedman
#' @rdname IDs
IDs <- function(x,...) {
UseMethod("IDs",x)
}
#' @method IDs default
#' @S3method IDs default
#' @rdname IDs
IDs.default <- function(x,...) {
stop("Currently only SpatialPolygonsDataFrames are supported.")
}
#' @method IDs SpatialPolygonsDataFrame
#' @S3method IDs SpatialPolygonsDataFrame
#' @rdname IDs
IDs.SpatialPolygonsDataFrame <- function(x,...) {
vapply(slot(x, "polygons"), function(x) slot(x, "ID"), "")
}
#' Assign sp feature IDs
#' @rdname IDs
"IDs<-" <- function(x, value) {
UseMethod("IDs<-",x)
}
#' @method IDs<- SpatialPolygonsDataFrame
#' @S3method IDs<- SpatialPolygonsDataFrame
#' @rdname IDs
"IDs<-.SpatialPolygonsDataFrame" <- function(x, value) {
spChFIDs(x,value)
}
そして、私はcheck
を実行します。
はここでかなり最小限の例です。私は理論上、@param value
を排除しようとしました。おそらく、Roxygenが代入関数のエントリを自動的に作成するのですが、それは(x,value,value)
の定義を排除するものではなく、value
を定義しなかったという新しい警告を生成します。
は、ここで生成された.Rd
の関連部分です:
\usage{
IDs(x, ...)
\method{IDs}{default} (x, ...)
\method{IDs}{SpatialPolygonsDataFrame} (x, ...)
IDs(x, value) <- value
\method{IDs}{SpatialPolygonsDataFrame} (x, value) <-
value
}
私はcheck
主張があることが(x, value, value)
署名が表示されません。
これはS3機能ですが、S4オブジェクトで動作しています。それはまだS3になるはずです。しかし、そうでなければ、@S3method
の私の使用が問題になるかもしれません。
ヘルプ?
それはおそらくだ実験[roxygen3](http://github.com/hadley/roxygen3/)の中でいくつかの点でバックroxygen2にマージされます将来は – hadley
これは関連しているようです:http://stackoverflow.com/questions/8873514/documenting-setter-functions-with-roxygen – Dason