2012-03-05 137 views
19

我試圖使用roxygen2記錄R程序包中的一些數據集。這些考慮只有一個:使用roxygen2記錄數據集

  • 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 
    

當我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} 

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 
... 

無處有我告訴R其中找到此數據集,但我會假設mypkg/data/<name>.RDa將是一個很好的第一個猜想。 任何提示都會很棒。

如果哈德利在看,我注意到\ usage部分沒有被創建,並且@ usage指令被忽略。

我使用roxygen-2.2.2,R上2.13.1

+4

我不知道的是,'@ export'指令用於數據本身TS。嘗試刪除此。 – 2012-03-05 05:27:34

+6

你不應該導出數據對象 – 2012-03-05 06:23:16

+3

謝謝你們。根據Writing R extensions 1.5.1,這需要2個修復(1),將對象保存爲.rda(而不是.RDa);和(2)刪除@export – drmjc 2012-03-05 23:25:15

回答