2016-04-26 65 views
6

我正在使用pkgdown包生成R包(稱爲RTCGA)的優雅靜態手冊頁。當我運行的代碼生成靜態文件的網站,我使用下面的命令pkgdown R包build_site函數導致依賴包無法加載

> pkgdown::build_site() 
Initialising site ------------------------------------------------------------------------------------- 
Copying '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.3/pkgdown/assets/jquery.sticky-kit.min.js' 
Copying '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.3/pkgdown/assets/link.svg' 
Copying '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.3/pkgdown/assets/pkgdown.css' 
Copying '/home/mkosinski/R/x86_64-pc-linux-gnu-library/3.3/pkgdown/assets/pkgdown.js' 
Building home ----------------------------------------------------------------------------------------- 
Writing '/home/mkosinski/GitHub/RTCGA/docs/index.html' 
Building function reference --------------------------------------------------------------------------- 
Loading RTCGA 
Welcome to the RTCGA (version: 1.5.1). 
trying URL 'http://gdac.broadinstitute.org/runs/stddata__2015_11_01/data/ACC/20151101/gdac.broadinstitute.org_ACC.Merge_mirnaseq__illuminahiseq_mirnaseq__bcgsc_ca__Level_3__miR_gene_expression__data.Level_3.2015110100.0.0.tar.gz' 
Content type 'unknown' length 309876 bytes (302 KB) 
================================================== 
downloaded 302 KB 

Warning: Topics missing from index: RTCGA-package, theme_RTCGA 
Building articles ------------------------------------------------------------------------------------- 
Building article 'RTCGA_Workflow.html' 
Building article 'Web_Applications.html' 

這段代碼在RTCGA包項目的根目錄進行評價,並給出了RTCGA加載信息和文檔的創建。

但我發現文件中的錯誤在大多數的網頁 - 有一個錯誤,告訴

Error: package ‘RTCGA’ required by ‘RTCGA.rnaseq’ could not be found

enter image description here

所以沒有實例可以運行。此外,當我運行library(RTCGA.rnaseq)我用build_site後,我再也不能

> library(RTCGA) 
> library(RTCGA.rnaseq) 
Error: package ‘RTCGA’ required by ‘RTCGA.rnaseq’ could not be found 

當我運行在新的會話library(RTCGA.rnaseq)沒有與任何警告調用pkgdown::build_site依賴RTCGA包負載通常依賴於負載RTCGA包。

我懷疑這是由build_site執行的任何設置引起的,但我不知道如何解決這些問題以及如何使用pkgdown軟件包構建正確的靜態文檔。

有何評論?

+0

此外交張貼在這裏https://github.com/hadley/pkgdown/issues/98移除了數據包的DependsRTCGA

回答

3

它看起來像我找到了一個討厭的變通。 RTCGA軟件包在其示例中使用8個數據包。每個數據包都需要加載RTCGA。 pkgdown::build_site()使用devtools::load_all(),它奇怪地只加載來自RTCGA的對象,但不允許在示例運行期間加載該包。

我已經改變這些包的元信息樣

packages_to_remove_RTCGA_from_Depends <- 
    c("RTCGA.clinical", 
    "RTCGA.mutations", 
    "RTCGA.rnaseq", 
    "RTCGA.RPPA", 
    "RTCGA.mRNA", 
    "RTCGA.miRNASeq", 
    "RTCGA.methylation", 
    "RTCGA.CNV") 

sapply(packages_to_remove_RTCGA_from_Depends, function(data_package){ 
    Meta <- readRDS(file.path(.libPaths()[1], data_package, "Meta", "package.rds")) 
    Meta$Depends <- list() 
    saveRDS(Meta, file.path(.libPaths()[1], data_package, "Meta", "package.rds")) 
})