简体   繁体   中英

documenting dataset with roxygen2

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM