问题
Let's say that package A defines and documents foo() and implements it for bar1 objects.
In a new package B, I would like to expand this method and add its support for bar2 objects.
Currently, I start by reexporting the method:
#' @rdname foo
#' @importFrom A foo
#' @export
A::foo
And then went on extending its behaviour:
#' @rdname foo
#' @method foo bar2
#' @export
foo.bar2 <- function(x, newparam = 3.14, ...){
  dosomething(x, newparam)
}
Unfortunately, it seems like this creates a conflict upon devtools checking, which returns the following warning:
> checking Rd metadata ... WARNING
  Rd files with duplicated name 'reexports':
    'foo.Rd'
  Rd files with duplicated alias 'reexports':
    'foo.Rd'
Thus, I wonder what this the best way of expanding a method without creating conflict in definition or documentation? Can I do this without having to Depend on the package A? Thanks!
来源:https://stackoverflow.com/questions/55465721/r-expand-an-s3-method-defined-in-another-package