I'm trying to document some datasets in an R package using roxygen2. Considering just one of these:
mypkg/data/CpG.human.GRCh37.RDa
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
The Roxygen2 comments are just R comments (preceded by # ), but you need to use #' to distinguish the Roxygen2 comments from any normal R comments. And it has things like @param rather than \item{} . There are still a few of .
The default R datasets included in the base R distribution Simply check the checkbox next to the package name to load the package and gain access to the datasets. You can also click on the package name and RStudio will open a help file describing the datasets in this package.
This required 2 fixes:
.rda
instead of .RDa
@export
from the RoxygenIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With