【发布时间】:2012-03-22 15:09:56
【问题描述】:
我正在尝试使用 roxygen2 在 R 包中记录一些数据集。只考虑其中之一:
- 我有
mypkg/data/CpG.human.GRCh37.RDa - 其中包含一个名为
CpG.human.GRCh37的对象 -
还有一个名为:
mypkg/R/cpg-data.R的文件,其中包含:#' @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
当我 roxygenize 时,它会创建 mypkg/man/CpG.human.GRCh37.Rd,包含:
\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 是一个很好的初步猜测。
任何提示都会很棒。
如果 Hadley 正在观看,我注意到没有创建 \usage 部分并且忽略了 @usage 指令。
我在 R 2.13.1 上使用 roxygen-2.2.2
【问题讨论】:
-
我不确定
@export指令是否用于数据集。尝试删除它。 -
你不应该导出数据对象
-
谢谢大家。这需要 2 个修复 (1) 根据编写 R 扩展 1.5.1,将对象保存为 .rda(不是 .RDa);和(2)删除@export
-
@mjc 请发表您的评论作为答案并将其标记为已回答以结束此问题。
-
@mjc,请发布答案并接受它,这样这个问题就不会显示为未回答。