7

checkRoxygenで割り当て関数を使用するのに問題があります。

これはかなり最小限の例です:

#' 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

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

value2番目がどこから来ているのかわかりません。@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
}

そこにあると主張する(x, value, value)署名が見当たりません。check

これはS3関数ですが、S4オブジェクトで動作しています。それでもS3になるはずだと思います。しかし、そうでない場合は、私の使用が@S3method問題である可能性があります。

ヘルプ?

4

1 に答える 1

5

これはかなりハックな方法ですが、roxygen がこれを処理する方法は当分の間まだ壊れているようです ( LINK )。ただし、使用セクションを直接 roxygen コメントに手動で追加できます。

#' Assign sp feature IDs
#' @rdname IDs
#' @usage IDs(x) <- value
"IDs<-" <- function( x, value ) {
    UseMethod("IDs<-",x)
}

#' @method IDs<- SpatialPolygonsDataFrame
#' @S3method IDs<- SpatialPolygonsDataFrame
#' @rdname IDs
#' @usage IDs(x) <- value
"IDs<-.SpatialPolygonsDataFrame" <- function( x, value) {
    spChFIDs(x,value)
}
于 2012-11-12T18:42:26.543 に答える