r-使用roxygen2记录数据集



我正试图使用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
    

当我加氧时,它被创建为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}

并且CCD_ 5被添加到CCD_。

但当我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

这需要2个修复:

  1. 如Writing R extensions 1.1.5,Data in packages中所述,将对象保存为.rda而不是.RDa
  2. 从Roxygen上删除@export

最新更新