R中的函数注释约定 [英] Function commenting conventions in R

查看:223
本文介绍了R中的函数注释约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚接触R,并且一直在脚本文件中定义一些自己的函数。我打算让其他人稍后再使用它们,但是我找不到有关R函数注释约定的任何指南。我有什么办法让 help( my_function_name)显示一些帮助?如果没有,我是否仅将功能记录在脚本文件中,以便有人必须打印出(或打开脚本的源代码)才能看到注释?

I'm fairly new to R, and I have been defining some of my own functions in script files. I'm intending for others to re-use them later, and I can't find any guides on R function commenting conventions. Is there any way for me to make help("my_function_name") show some help? If not, do I just document the function in the script file, so that someone has to print out (or open the source of) a script to see the comments?

谢谢,

Hamy

推荐答案

更新此问题12月自2011年最初写起以来,R-universe就在2019年发生了变化

我推荐的资源现在是 http://r-pkgs.had.co.nz/

原始答案(链接大多已过期)

记录功能并使他人可以使用的规范方法是制作一个包装。为了使您的软件包通过构建检查,您必须为每个函数/数据集提供足够详细的帮助文件。

The canonical way to document your functions and make them accessible to others is to make a package. In order for your package to pass the build checks, you have to supply sufficiently detailed help files for each of your functions / datasets.

签出 http://cran.r-project.org/doc/manuals/ R-exts.html#Creating-R-packages

Rob J Hyndman的这篇博客文章非常有用,也是我最容易理解的文章之一: http://robjhyndman.com/researchtips/building-r-packages-for -windows /

This blog post from Rob J Hyndman was very useful and one of the easiest for me to follow: http://robjhyndman.com/researchtips/building-r-packages-for-windows/

我已经开始使用roxygen来帮助制作&最近编译软件包: http://roxygen.org/

I've started using roxygen to assist in making & compiling packages as of late: http://roxygen.org/

有很多好的资源,有人在遇到问题时会提供帮助!

Lots of good resources and people to help when you have questions!

这篇关于R中的函数注释约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆