使用Roxygen的内联包装概述文档 [英] Inline package overview documentation using roxygen

查看:82
本文介绍了使用Roxygen的内联包装概述文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这是我在文档中经常忽略的一件简单的事情,但是我似乎无法弄清楚如何使程序包级文档在R中工作.我不是在指功能或特定于类的东西.文档,但键入时获得的文档,例如,?stats.

I imagine this is a simple thing that I keep overlooking in the documentation, but I can't seem to figure out how to get package-level documentation to work in R. I'm not referring to function or class-specific documentation, but the documentation that you get when you type, for example, ?stats.

我遵循了我在网上找到的一般说明,创建了一个保存为.R的概要文档文件. .R文件是使用程序包脚本复制的,但是帮助文档并未编入.Rd文件(除非我添加了也以程序包命名的函数定义).

I've followed the general instructions I've found on the web, creating a sckeleton documentation file saved as .R. The .R file is copied with the package scripts, but the help documentation doesn't get made into a .Rd file (unless I add a function definition also named after the package).

我尝试过的例子:

#'_PACKAGE
#'MyPackage
#'
#'MyPackage description
#'
#'MyPackage details
#'@alias{MyPackage}
#'@alias{MyPackage-package}

由于某种原因,我很难找到有关如何设置常规软件包文档的良好示例.我已经写了很多功能帮助文件,而且我知道roxygen可以找到我的程序包帮助文件,但是还不清楚为什么我不能从中生成.Rd.

I'm having a hard time finding good examples of how to set up general package documentation, for some reason. I've written quite a few function help files, and I know my package help file is being found by roxygen, but it's unclear why I can't generate an .Rd from it.

推荐答案

在上面的评论中@slickrickulicious的回答:

Answer courtesy of @slickrickulicious in the comments above:

我需要在文档文件的末尾添加NULL并包含'@name MyPackage'.这样做可以正确生成软件包帮助文件.

I needed to add NULL at the end of my documentation file and include '@name MyPackage'. Doing so generated the package help file correctly.

这篇关于使用Roxygen的内联包装概述文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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