How to use @inheritParams when expanding primitive functions in R

342 views Asked by At

I want to document a new method using R S4 system, for example sqrt() :

##' Extend sqrt
##'
##' @title sqrt for myClass
##' @inheritParams sqrt
##' @return A numeric vector.
##' @exportMethod sqrt
##' 
setMethod(f = 'sqrt',
          signature = 'myClass',
          definition = function(x) {
            ...
          })

When I executed devtools::document(), I got a warning message like Warning: @inheritParams: can't find topic sqrt. I would like to know how to correctly use @inheritParams in such case.

1

There are 1 answers

0
Sébastien Rochette On

It is an old topic but it can maybe help others...
As far as I know, to copy parameter defintion from another function, you may use @inheritParams fun when the function exists in your package.
If this is not the case, you may use @inheritParams package::fun