documenting dataset with roxygen2

穿精又带淫゛_ 提交于 2019-12-21 03:19:26

问题


I'm trying to document some datasets in an R package using roxygen2. Considering just one of these:

  • 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
    

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}

and export(CpG.human.GRCh37) gets added the NAMESPACE file.

but when I R CMD CHECK I get:

...
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) : 
  undefined exports: CpG.human.GRCh37
Error: loading failed
...

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.

If Hadley's watching, I notice that an \usage section is not created and the @usage directive is ignored.

i'm using roxygen-2.2.2, on R 2.13.1


回答1:


This required 2 fixes:

  1. As explained in Writing R extensions 1.1.5, Data in packages, save the objects as .rda instead of .RDa
  2. remove @export from the Roxygen


来源:https://stackoverflow.com/questions/9561684/documenting-dataset-with-roxygen2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!