Ho problemi con le funzioni di assegnazione check
con Roxygen.La documentazione della funzione di assegnazione non funziona R CMD CHECK
Ecco un esempio abbastanza minimal:
#' 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)
}
E quando corro 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)
Non capisco dove il secondo value
proviene. Ho provato a eliminare lo @param value
sulla teoria che forse Roxygen crea automaticamente una voce per le funzioni di assegnazione, ma ciò non elimina la definizione (x,value,value)
e genera un nuovo avviso che lamenta che non ho definito value
.
Ecco la quota di competenza del .Rd
generato:
\usage{
IDs(x, ...)
\method{IDs}{default} (x, ...)
\method{IDs}{SpatialPolygonsDataFrame} (x, ...)
IDs(x, value) <- value
\method{IDs}{SpatialPolygonsDataFrame} (x, value) <-
value
}
non vedo la firma (x, value, value)
che check
affermazioni c'è.
Questa è una funzione S3 ma funziona su un oggetto S4. Questo dovrebbe comunque renderlo S3, penso. Ma se così non fosse potrebbe essere che il mio uso di @S3method
è il problema.
Aiuto?
E 'probabilmente perché il supporto S4 in roxygen2 succhia :(È possibile provare la sperimentale [roxygen3] (http://github.com/hadley/roxygen3/) che sarà fusa nuovamente dentro roxygen2 ad un certo punto della futuro – hadley
Questo sembra essere correlato: http://stackoverflow.com/questions/8873514/documenting-setter-functions-with-roxygen – Dason