簡體   English   中英

從 GitHub 上的 R package 下載小插圖(Rmd)?

[英]Download vignettes (Rmd) from R package on GitHub?

我正在嘗試從 GitHub 上的私有存儲庫安裝GitHub Package 對象(例如datafunctions )已按應有的方式下載,但我缺少vignettes ,即位於.Rmd/vignettes文件夾中的 .Rmd。

library(devtools)
devtools::install_github("person_name/repo_name", build_vignettes = TRUE, auth_token =  "xxx")

我的目標是能夠使用install_github()從 package 下載functionsdata.Rmd

Ideally, the functions and data from the package would be in the RStudio memory (which works fine), while the .Rmd file should be downloaded locally to the directory I'm in when I download the package.

目的是使用戶可以輕松地使用包含的datafunctions重新運行分析( .Rmd )。

這是可能的還是我誤解了 function?

小插圖不存儲在本地工作目錄中。 它們存儲在 package 包本身中。 您通常使用

vignette("topicname", package="packagename")

如果您想獲取該 RMD 文件的路徑(假設源文件是 markdown 文件,並非所有軟件包都如此),您可以編寫一個小助手

get_vignette_source_path <- function(...) {
   v <- vignette(...)
   file.path(v$Dir, v$File)
}

例如使用dplyr "colwise" 幫助

get_vignette_source_path("colwise", package="dplyr")

您也可以讓它將文件復制到您的工作目錄

file.copy(get_vignette_source_path("colwise", package="dplyr"), ".")

如果您願意,可以在 package 中包含 function 來執行此操作。 您還可以實際打開源文件本身的編輯 window

edit(vignette("colwise", package="dplyr"))

然后用戶可以將該值保存在他們喜歡的位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM