我正在使用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
roxygen2
可以很好地生成文档。但是,它将anorexia.sub.roxygen.R
添加到我的DESCRIPTION
文件中的Collate
字段中:
Collate:
'granova.R'
'theme-defaults.R'
'granovagg.1w.R'
'granovagg.contr.R'
'granovagg.ds.R'
'help.R'
'anorexia.sub.roxygen.R'
我的问题是:如何从roxygen块自动生成数据文档,
- 不将数据文档文件添加到
Collate
调用中, - 避免使用需要hack的解决方案
NULL
,以便正确生成.Rd文件。 - Matt Parker