用roxygen2记录数据集 [英] documenting dataset with roxygen2
问题描述
我正在尝试使用roxygen2在R包中记录一些数据集.仅考虑其中之一:
I'm trying to document some datasets in an R package using roxygen2. Considering just one of these:
- 我有
mypkg/data/CpG.human.GRCh37.RDa
- 包含一个名为
CpG.human.GRCh37
的对象
-
和一个名为:
mypkg/R/cpg-data.R
的文件,其中包含:
- I have
mypkg/data/CpG.human.GRCh37.RDa
- which contains an object called
CpG.human.GRCh37
and a file called:
mypkg/R/cpg-data.R
, which contains:
#' @name CpG.human.GRCh37
#' @title CpG islands - human - genome build: GRCh37/hg19
#' @description This data set list the genomic locations of human CpG islands,
#' with coordinates based on the GRCh37 / hg19 genome build.
#' @docType data
#' @usage CpG.human.GRCh37
#' @format a \code{RangedData} instance, 1 row per CpG island.
#' @source UCSC Table Browser
#' @author Mark Cowley, 2012-03-05
#' @export
NULL
当我充氧时,它会被创建为mypkg/man/CpG.human.GRCh37.Rd
,其中包含:
When I roxygenize, this gets created mypkg/man/CpG.human.GRCh37.Rd
, containing:
\docType{data}
\name{CpG.human.GRCh37}
\alias{CpG.human.GRCh37}
\title{CpG islands - human - genome build: GRCh37/hg19}
\format{a \code{RangedData} instance, 1 row per CpG island.}
\source{
UCSC Table Browser
}
\description{
This data set list the genomic locations of human CpG
islands, with coordinates based on the GRCh37 / hg19
genome build.
}
\author{
Mark Cowley, 2012-03-05
}
\usage{CpG.human.GRCh37}
\keyword{datasets}
和export(CpG.human.GRCh37)
被添加NAMESPACE
文件.
但是当我R CMD CHECK
我得到:
...
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) :
undefined exports: CpG.human.GRCh37
Error: loading failed
...
我没有告诉R在哪里可以找到此数据集,尽管我认为mypkg/data/<name>.RDa
将是一个很好的第一个猜测.
任何提示都很棒.
Nowhere have I told R where to find this dataset, though I would assume that the mypkg/data/<name>.RDa
would be a good first guess.
Any hints would be awesome.
如果Hadley在观看,我会注意到未创建\ usage节,而@usage指令将被忽略.
If Hadley's watching, I notice that an \usage section is not created and the @usage directive is ignored.
我在R 2.13.1上使用roxygen-2.2.2
i'm using roxygen-2.2.2, on R 2.13.1
推荐答案
这需要2个修复程序:
- 如编写R扩展 1.1.5中所述,
- As explained in Writing R extensions 1.1.5, Data in packages, save the objects as
.rda
instead of.RDa
- remove
@export
from the Roxygen
这篇关于用roxygen2记录数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!