我無法使用 Rstudio(版本 4.0.4)在 Github 上安裝包。包在這里:https ://github.com/stmueller/psimetrica-R
我嘗試使用以下命令直接從控制臺安裝:
install.packages("psimetrica-R", repos = "https://github.com/stmueller/psimetrica-R.git")
這會導致 Rstudio 列印以下錯誤:
install.packages 中的警告:無法訪問存盤庫 https://github.com/stmueller/psimetrica-R.git/src/contrib的索引:無法打開 URL 'https://github.com/stmueller/psimetrica-R。 git/src/contrib/PACKAGES' install.packages 中的警告:包 'psimetrica-R' 不適用于此版本的 R
您的 R 版本的此包的版本可能在其他地方可用,請參閱 https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages 中的警告install.packages:無法訪問存盤庫的索引 https://github.com/stmueller/psimetrica-R.git/bin/windows/contrib/4.0:無法打開 URL 'https://github.com/stmueller/psimetrica- R.git/bin/windows/contrib/4.0/PACKAGES'
我也試過:
devtools::install_github("stmueller/psimetrica-R")
什么導致:
錯誤:無法從 GitHub 安裝“未知包”:HTTP 錯誤 404。未找到
您是否正確拼寫了 repo 所有者 (
stmueller) 和 repo 名稱 (psimetrica-R)?如果拼寫正確,請檢查您是否具有訪問存盤庫所需的權限。
我還嘗試從 repo 頁面下載 ZIP 檔案并安裝:
install.packages("C:/Users/lyamm/Downloads/psimetrica-R-master.zip", repos = NULL, type = "win.binary")
什么導致...
將軟體包安裝到“C:/Users/lyamm/Documents/R/win-library/4.0”(因為未指定“lib”) install.packages 中的警告:無法打開壓縮檔案“psimetrica-R-master/DESCRIPTION”,可能原因“沒有這樣的檔案或目錄” install.packages 中的錯誤:無法打開連接
難道我做錯了什么?還是包本身有/缺少檔案的問題?
uj5u.com熱心網友回復:
github源存盤庫不是像 CRAN 那樣的 R 包存盤庫,因此您不能使用install.packages().
相反,remotes::install_gihub()使用
if (!requireNamespace("remotes", quietly=TRUE)) install.packages("remotes")
remotes::install_github("stmueller/psimetrica-R")
如果需要,這將安裝remotes,并使用它來安裝所需的包。
或者,至少,如果 psimetrica-R是常規的 R 源代碼包,這在原則上是可行的。在這里它失敗了,因為它的布局:
> remotes::install_github("stmueller/psimetrica-R")
Error: Failed to install 'unknown package' from GitHub:
cannot open URL 'https://api.github.com/repos/stmueller/psimetrica-R/contents/DESCRIPTION?ref=HEAD'
>
因此,您可以分叉存盤庫并首先將其打包。至少開源可以讓你做到這一點。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/490903.html
上一篇:沒有下載按鈕的PDF收費欄
