列表项的 Roxygen 文档

发布于 2024-10-09 18:31:05 字数 1374 浏览 2 评论 0原文

我正在学习 Roxygen,到目前为止取得了良好的进展。我已经能够记录我正在处理的大部分包,但有一些地方我似乎无法正确处理。请考虑以下最小 R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

list() 内的注释刚刚被 Roxygen 删除 我已经确认了这一点:

> parse.file("package-test/R/simple.R")
$`1`
$`1`$description
[1] "Test Roxygen Comments\n\nThis is a test of the Roxygen System. Had this been actual\ndocumentation, it may have contained information about the\ndirectives and/or structures below.\n\n"

$`1`$name
[1] "simple\n"

$`1`$docType
[1] "data"

$`1`$rdname
[1] "simple"

$`1`$assignee
[1] "variable"

$`1`$srcref
$`1`$srcref$filename
[1] "package-test/R/simple.R"

$`1`$srcref$lloc
[1] 11  1 17  1  1  1

我有一个选项设置基础设施,我想使用它Roxygen 记录各个选项。我是否缩进注释似乎并不重要,将它们向左移动似乎没有帮助。将 @rdname 添加到每个块似乎也没有帮助。我只是期待不存在的行为吗?在另一个问题中,接受的答案表示我们可以将 Roxygen 评论放在任何地方,并且它们会被收集。

所以有两个方面:我在上面遗漏了什么,以及其他人如果不喜欢我的尝试,如何记录单个数据项?

谢谢你!

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

> parse.file("package-test/R/simple.R")

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$description [1] "Test Roxygen Comments\n\nThis is a test of the Roxygen System. Had this been actual\ndocumentation, it may have contained information about the\ndirectives and/or structures below.\n\n"

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$name [1] "simple\n"

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$docType [1] "data"

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$rdname [1] "simple"

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$assignee [1] "variable"

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$srcref

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$srcref$filename [1] "package-test/R/simple.R"

I am learning Roxygen and making good progress so far. I've been able to document most of the package that I'm working on, but I've got a few places that I can't seem to get right. Please consider the following minimal R:

##' Test Roxygen Comments
##'
##' This is a test of the Roxygen System. Had this been actual
##' documentation, it may have contained information about the
##' directives and/or structures below.
##'
##' @name simple
##' @docType data
##' @rdname simple

variable <- list(
                 ##' itema comments
                 itema <- c("bing", "bang", "bong"),

                 ##' itemb comments
                 itemb <- "fooflakes"
)

##' More info abuot variable!
##' @rdname simple

The comments that are inside the list() are just dropped by Roxygen I've confirmed this with:

1`$srcref$lloc [1] 11 1 17 1 1 1

I have an options setting infrastructure, for which I'd like to use Roxygen to document the individual options. It doesn't seem to matter whether or not I indent the comments, moving them flush-left doesn't seem to help. Adding @rdname to every block doesn't seem to help either. Am I just expecting behavior that doesn't exist? In another question, the accepted answer said we could put Roxygen comments anywhere and that they would be collected.

So two fold: what am I missing above, and how do other people document individual data items if not like my attempt?

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我的鱼塘能养鲲 2024-10-16 18:31:05

Roxygen 不会这样做。我还需要 5 个字符才能作为正式答案。

Roxygen does not do that. I need 5 more characters to be an official answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文