如何在不将其添加到"逐份打印"字段的情况下记录数据集?

bri*_*ndk 10 r roxygen roxygen2

我正在roxygen2用于记录我正在开发的包的数据集.我知道你可以使用roxygen来记录数据集,但Shane的回答最终暗示了一个hack,而我宁愿避免.所以,我的问题是:

我应该在哪里放置数据的roxygen文档?

我目前有一个数据文档文件(anorexia.sub.roxygen)用于我/ R文件夹中的厌食症数据集

我的包目录

因为据我所知,这是roxygen2寻找它的唯一地方:

#' Family Treatment Weight change data for young female anorexia patients.
#' 

#' 
#' The MASS package includes the dataset \code{anorexia}, containing pre and
#' post treatment weights for young female anorexia patients.  This is a subset
#' of those data, containing only those patients who received Family Treatment.
#' 
#' 
#' @name anorexia.sub
#' @docType data
#' @format A dataframe with 17 observations on the following 2 variables, no
#'   NAs.
#'
#' \describe{
#' 
#' \item{list("Prewt")}{Pretreatment weight of subject, in pounds.}
#' 
#' \item{list("Postwt")}{Postreatment weight of subject, in pounds.}
#' 
#' }
#' @references Venables, W. N. and Ripley, B. D. (2002) Modern Applied
#'   Statistics with S. Fourth edition. Springer.
#' @source Hand, D. J., Daly, F., McConway, K., Lunn, D. and Ostrowski, E. eds
#'   (1993) A Handbook of Small Data Sets. Chapman & Hall, Data set 285 (p.
#'   229)
#' @keywords datasets
NULL
Run Code Online (Sandbox Code Playgroud)

roxygen2生成文档就好了.但是,然后它anorexia.sub.roxygen.R在我的Collate领域DESCRIPTION:

Collate:
    'granova.R'
    'theme-defaults.R'
    'granovagg.1w.R'
    'granovagg.contr.R'
    'granovagg.ds.R'
    'help.R'
    'anorexia.sub.roxygen.R'
Run Code Online (Sandbox Code Playgroud)

我想我的问题是:我怎么能有roxygen2

  1. 从roxygen块自动生成数据文档,
  2. 不要将数据文档文件添加到Collate调用AND中
  3. 避免需要破解的解决方案

And*_*rie 16

由于最好在包级别功能级别记录您的包,因此我总是在文件R夹中有一个文件packagename-package.R(例如granovaGG-package.R在您的情况下),我保存包文档以及数据文档.

所以你的granovaGG-package.R文件看起来像:

#' One sentence summary of your package.
#' 
#' More detail
#' ...
#' @name granovaGG-package
#' @aliases granovaGG
#' @docType package
#' @title One sentence summary of your package.
#' @author \email{your.name@@email.com}
#' @keywords package
#' @seealso \code{\link{...}}
NULL
#' Your dataset documentation goes here.
#' 
#' Exactly as in your example.
#' @docType data
#' etc.
#' ...
NULL
Run Code Online (Sandbox Code Playgroud)