gpt4 book ai didi

r - 使用 roxygen2 记录数据帧列表

转载 作者:行者123 更新时间:2023-12-01 23:41:25 31 4
gpt4 key购买 nike

我正在尝试记录我附加到包中的一些数据。

我有一个包含 3 个元素的列表 (data.frames),每个数据框都有一些列。我想知道如何在 roxygen2 中记录这种层次结构(列表 -> data.frame -> 列)。这些示例始终只显示一层、data.frame,然后是列名。这是一个列表中包含两个数据框的最小示例。

list(
names=data.frame(id=1:10, a=letters[1:10]),
values=data.frame(id=rep(1:10, each=10), values=runif(100))
)

在我的列表中,所有三个 data.frames 都与一个 id 列相连,所以它们有点相关,但我不想将它们放在一个数据框中,因为保存内存。

欢迎提出任何建议。

编辑

我试图在我的文档中添加段,但这似乎不起作用

#' List with group information for the test data set
#'
#' This dataset is a list with 2 data.tables (proteins, timepoint).
#' It has a common id column in all data.tables.
#'
#' \strong{proteins}
#' @format A data frame with 5458 rows and 3 columns
#' \describe{
#' \item{id}{unique group id}
#' \item{names}{individual names}
#' \item{other names}{other names}
#' }
#'
#' \strong{timepoint}
#' @format A data frame with 80248 rows and 5 columns
#' \describe{
#' \item{id}{unique group id}
#' \item{timepoint}{individual timepoint}
#' \item{imputed_mean}{mean value including imputed values}
#' \item{measured_mean}{mean value without imputing (contains NAs)}
#' \item{value_count}{number of measured values within the replicates}
#' }
'pg_test'

输出看起来只能处理 1 个 @format 参数。

还有什么建议吗?

最佳答案

其实,我只是想出了一个解决方案,只要没有人有更好的建议...

#' List with group information for the test data set
#'
#' This dataset is a list with 2 data.tables (proteins, timepoint).
#' It has a common id column in all data.tables.
#'
#' @format
#' \enumerate{
#' \item \strong{proteins} A data frame with 5458 rows and 3 columns
#' \describe{
#' \item{id}{unique group id}
#' \item{names}{individual names}
#' \item{other names}{other names}
#' }
#'
#' \item \strong{timepoint} A data frame with 80248 rows and 5 columns
#' \describe{
#' \item{id}{unique group id}
#' \item{timepoint}{individual timepoint}
#' \item{imputed_mean}{mean value including imputed values}
#' \item{measured_mean}{mean value without imputing (contains NAs)}
#' \item{value_count}{number of measured values within the replicates}
#' }
#' }
'pg_test'

也可以用

来解决
#' \describe{
#' \item{One}{First item}
....

而不是 \enumerate 我猜。但此解决方案目前有效。

关于r - 使用 roxygen2 记录数据帧列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38095578/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com