问题
I'm working on R package. I set aliases for some functions this way:
foo <- function(){
do_something
}
foo_alias <- foo
I have the documentation for 'foo' function, so when typing:
?foo
I get the created documentation. Unfortunately it does not work for foo_alias. When I type:
?foo_alias
I get nothing. Is there any solution for that so the alias function inherits the documentation from foo?
回答1:
You should add an alias to your documentation file:
\name{foo}
\alias{foo}
\alias{foo_alias}
Or if you use roxygen2
:
#' @name foo
foo <- function()
#' @rdname foo
foo_alias <- foo
来源:https://stackoverflow.com/questions/30773762/r-functions-aliases-documentation