Search code examples
rroxygen2

Redirecting the document help page for a function


within my own package, I want to redirect the appearing help page for a function to the documentation of another function. For e.g., when I click F1 key on "is.matrix()" or on "as.matrix()" in both cases the help page / documentation of "matrix()" appears. How do I realize that with my own functions?

abc <- function(data, ...) {  }
as.abc <- function(data, ...) {  }
is.abc <- function(x) {  }

I only want to implement one documentation for abc() and the documentation for as.abc() and is.abc() should be the one for abc().

Thanks in advance!


Solution

  • What you're looking for is the @rdname. See e.g. http://www.iysik.com/r/roxygen2

    In your case, you would do

    #' abc-function title
    #' @rdname abc
    #' @export
    #' @param data Document your parameters, please!
    abc <- function(data, ...) {  }
    
    #' @rdname abc
    #' @export
    #' @inheritParams abc
    as.abc <- function(data, ...) {  }
    
    #' @rdname abc
    #' @export
    #' @param x x
    is.abc <- function(x) {  }