我正在使用roxygen2
来记录我正在开发的包的数据集。我知道你可以use roxygen to document a dataset,但是Shane's answer最终暗示了一个黑客,而我宁愿避免。所以,我的问题是:
我目前有厌食数据集in my /R folder的数据文档文件(anorexia.sub.roxygen
)
因为据我所知,这是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
添加到Collate
中的DESCRIPTION
字段:
Collate:
'granova.R'
'theme-defaults.R'
'granovagg.1w.R'
'granovagg.contr.R'
'granovagg.ds.R'
'help.R'
'anorexia.sub.roxygen.R'
我想我的问题是:我怎么能有roxygen2
Collate
调用,AND 答案 0 :(得分:16)
由于最好在package level以及function level记录您的包,因此我总是在名为R
的{{1}}文件夹中有一个文件(例如{ {1}}在你的情况下)我保存包文档和数据文档。
因此,您的packagename-package.R
文件可能类似于:
granovaGG-package.R