Hi,

I am struggling a bit with a R generic function. I build a generic and set two implementations of the generic with two different signatures as input. Both implementations of the generic produce the same output but have a different input. During devtools::check() I get the following error:

❯ checking Rd \usage sections ... WARNING
  Duplicated \argument entries in documentation object 'methodA':
    ‘x’ ‘size’

 Functions with \usage entries need to have the appropriate \alias
  entries, and all their arguments documented.
  The \usage entries must correspond to syntactically valid R code.
  See chapter ‘Writing R documentation files’ in the ‘Writing R
  Extensions’ manual.


The original functions are complex so here are some dummy methods:


#' methodA methods generic
#' @rdname methodA-methods
#' @export
#'
setGeneric("methodA", function(x, size = 1000)
  standardGeneric("methodA"))


#' methodA method for \code{GRanges} input
#'
#' @param x a \code{GRanges} object
#' @param size a \code{numeric} vector
#'
#' @import GenomicRanges
#' @return a \code{list} object
#' @rdname methodA-methods
#' @export
#' @examples
#' library(GenomicRanges)
#' dat.GRanges <- GRanges(seqnames=c(rep("chr1", 5), rep("chr2", 5)),
#' IRanges(start = rep(c(10000, 10000, 55000, 55000, 150000), 2),
#' end = rep(c(20000, 20000, 70000, 70000, 600000), 2)))
#' out.list <- methodA(x = dat.GRanges, size = length(dat.GRanges))
#'
setMethod(methodA, signature(x="GRanges"),
          function(x, size = 1000){
            s <- start(x)
            return(list(s, size))
          })



#' methodA method for named \code{integer} input
#'
#' @param x a \code{integer} vector
#' @param size a \code{numeric} vector
#'
#' @return a \code{list} object
#' @export
#' @rdname methodA-methods
#' @examples
#' dat <- 1:20
#' out.list <- methodA(x = dat, size = length(dat))
setMethod(methodA, signature(x="integer"),
          function(x, size = 1000){
            return(list(x, size))
          })

The error above sounds absolute understandable for me, but I do not have a solution for this. Maybe using a generic is not the way to do this here?

Tobias

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to