Assignment function documentation not completed R CMD CHECK

I'm having problems with check assignment functions using Roxygen.

Here's a pretty minimal example:

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

And when I ran 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) 

I do not understand where the second value comes from. I tried to exclude the @param value theory that Roxygen might automatically create an entry for the destination functions, but this does not eliminate the definition of (x,value,value) and gives a new warning complaining that I did not define the value .

Here the corresponding .Rd part .Rd generated:

 \usage{ IDs(x, ...) \method{IDs}{default} (x, ...) \method{IDs}{SpatialPolygonsDataFrame} (x, ...) IDs(x, value) <- value \method{IDs}{SpatialPolygonsDataFrame} (x, value) <- value } 

I do not see the signature (x, value, value) in which there is a check .

This is an S3 function, but it works on an S4 object. I think it will make it S3 anyway. But if it is not, then the problem is using @S3method .

reference

+6
source share
1 answer

This is a pretty hacky way around this, but it looks like the way roxygen handles this is still not working ( LINK ). But you can manually add a usage section to your roxygen comments directly.

 #' 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) } 
+4
source

All Articles