使用roxygen2记录数据集

drm*_*mjc 19 packaging r rd 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
    
    Run Code Online (Sandbox Code Playgroud)

当我进行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}
Run Code Online (Sandbox Code Playgroud)

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
...
Run Code Online (Sandbox Code Playgroud)

我没有告诉R在哪里可以找到这个数据集,尽管我认为这mypkg/data/<name>.RDa是一个很好的第一个猜测.任何提示都会很棒.

如果Hadley正在观看,我注意到没有创建\ usage部分,并且忽略了@usage指令.

我在R 2.13.1上使用roxygen-2.2.2

And*_*rie 16

这需要2个修复:

  1. 编写R扩展 1.1.5,包中的数据中所述,将对象保存为.rda而不是.RDa
  2. 除去@export从Roxygen