R functions' aliases documentation

孤街浪徒 提交于 2019-12-01 07:07:51

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!