2015-04-01 283 views
5

我嘗試從github下載tsdyn包(它尚未更新到cran),但是我的代理阻止了我連接到github。如何從github手動或離線安裝R包

library(devtools) 
install_github("MatthieuStigler/tsDyn", ref="Dev94", subdir="tsDyn") 

Downloading github repo MatthieuStigler/[email protected] 
Erreur dans function (type, msg, asError = TRUE) : 
Failed to connect to api.github.com port 443: Connection refused 

然後我下載的.zip並試圖從.zip文件安裝包,並得到這個錯誤:

Erreur dans read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package",  "Type")) : 
impossible d'ouvrir la connexion 
De plus : Message d'avis : 
In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : 
impossible d'ouvrir le fichier compressé 'tsDyn-master/DESCRIPTION', cause probable : 'No such file or directory' 

我不明白,因爲我能找到的信息庫中的描述文件。 我認爲它是試圖連接到互聯網,這是我的專業connexion不允許的。 我發現有些人用Linux成功地讓它通過另一個端口下載比443(端口8000必須被允許我認爲但不確定),但我有Windows 7. 我有管理員憑據,它不工作,無論是當我嘗試使用R作爲管理員。 我真的不知道任何有關代理配置的信息,所以如果您有任何想法,請嘗試成爲我應該做的更具體的行動。

非常感謝提前!

EDIT1:我想你的建議,並刪除文件庫中的不必要的水平,我做了一個

Rscript -e "install.packages ('C:/Users/stephanie/Downloads/tsDyn.zip',repos=NULL) " 

,我從終端得到了「安裝包到「C:/用戶/斯蒂芬妮/文檔/R/win-library/3.1'(因爲'lib'是未指定的)。它似乎工作,但是當我在RI中使用命令庫(tsDyn)時得到了「Erreur dans library(tsDyn)」,'tsDyn'n'est pas un nom correct de packageinstallé「(不是我用英文安裝的軟件包的正式名稱)儘管這些文件存在於win庫中,但我注意到其他軟件包目錄中總是存在的文件MD5和INDEX是這裏不存在一個想法?

EDIT2:我找到了解決辦法,撤除勸不必要的水平,我下次使用devtools的安裝功能,它的工作(脫機)...

library(devtools) 
install("C:/Users/stephanie/Downloads/tsDyn") 

我真的不明白與差異終端命令如此,如果有人可以給我線索,我已經解決了我的PB,但我會有興趣瞭解如何!

+0

你試過用什麼命令來安裝ZIP文件? – hrbrmstr 2015-04-01 12:12:01

+0

我選擇«從zip文件安裝包»在菜單«包» – 2015-04-01 13:39:06

回答

1

上移的一切行動一個水平,使你沒有一箇中間文件夾,名爲tsDyn並可以:

install_github("MatthieuStigler/tsDyn") 

或留下的東西,因爲他們和

install_github("MatthieuStigler/tsDyn/tsDyn") 

證明是在布丁

library(devtools) 
install_github("MatthieuStigler/tsDyn/tsDyn") 

    # Downloading github repo MatthieuStigler/[email protected] 
# Installing tsDyn 
# "C:/PROGRA~1/R/R-31~1.2/bin/x64/R" --vanilla CMD INSTALL \ 
# "C:/Users/dominic/AppData/Local/Temp/RtmpiwFHUz/devtools30d0779d2870/MatthieuStigler-tsDyn-8048816/tsDyn" \ 
# --library="D:/Copy/R/win-library/3.1" --install-tests 
# 
# * installing *source* package 'tsDyn' ... 
# ** libs 
# 
# *** arch - i386 
# gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/extralibs64/local/include"  -O3 -Wall -std=gnu99 -mtune=core2 -c llar.c -o llar.o 
# gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/extralibs64/local/include"  -O3 -Wall -std=gnu99 -mtune=core2 -c misc.c -o misc.o 
# gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/extralibs64/local/include"  -O3 -Wall -std=gnu99 -mtune=core2 -c search.c -o search.o 
# gcc -m32 -shared -s -static-libgcc -o tsDyn.dll tmp.def llar.o misc.o search.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.2/bin/i386 -lR 
# installing to D:/Copy/R/win-library/3.1/tsDyn/libs/i386 
# 
# *** arch - x64 
# gcc -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/extralibs64/local/include"  -O2 -Wall -std=gnu99 -mtune=core2 -c llar.c -o llar.o 
# gcc -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/extralibs64/local/include"  -O2 -Wall -std=gnu99 -mtune=core2 -c misc.c -o misc.o 
# gcc -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG  -I"d:/RCompile/CRANpkg/extralibs64/local/include"  -O2 -Wall -std=gnu99 -mtune=core2 -c search.c -o search.o 
# gcc -m64 -shared -s -static-libgcc -o tsDyn.dll tmp.def llar.o misc.o search.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.2/bin/x64 -lR 
# installing to D:/Copy/R/win-library/3.1/tsDyn/libs/x64 
# ** R 
# ** data 
# ** inst 
# ** tests 
# ** preparing package for lazy loading 
# ** help 
# *** installing help indices 
# ** building package indices 
# ** installing vignettes 
# ** testing if installed package can be loaded 
# *** arch - i386 
# *** arch - x64 
# * DONE (tsDyn) 

library(tsDyn) 
tsDyn::autopairs 

# function (x, lag = 1, h, type = c("levels", "persp", "image", 
#  "lines", "points", "regression")) 
# { 
#  panel <- list(levels = function() sm::sm.density(X, h = rep(h, 
#   2), xlab = xlab, ylab = ylab, main = "density", display = "slice"), 
#   persp = function() sm::sm.density(X, h = rep(h, 2), xlab = xlab, 
#    ylab = ylab, main = "density", display = "persp"), 
#   image = function() sm::sm.density(X, h = rep(h, 2), xlab = xlab, 
#    ylab = ylab, main = "density", display = "image"), 
#   lines = function() plot(X, xlab = xlab, ylab = ylab, 
#    main = "lines", type = "l"), points = function() plot(X, 
#    xlab = xlab, ylab = ylab, main = "scatter"), regression = function() sm::sm.regression(X[, 
#    1], X[, 2], h = h, xlab = xlab, ylab = ylab, main = "regression", 
#    ask = FALSE)) 
#  lags <- c(-lag, 0) 
#  X <- embedd(x, lags = lags) 
#  xlab <- paste("lag", lag) 
#  ylab <- paste("lag", 0) 
#  type <- match.arg(type) 
#  if (missing(h)) { 
#   h <- sm::hnorm(X)[1] 
#  } 
#  panel[[type]]() 
# } 
# <environment: namespace:tsDyn> 
+0

你真的認爲這可能有幫助嗎?我不明白爲什麼,因爲我似乎有一個連接/代理pb – 2015-04-01 13:39:59

+0

看到我的編輯,這應該說服你... – 2015-04-01 13:56:36

+0

好吧然後我會試試這個,謝謝! – 2015-04-01 14:09:42

1

您可以通過在防火牆後面工作時設置代理來避免此問題。從Rstudio安裝代理的說明位於Link

  1. 檢查您的IT管理員應該使用哪個代理訪問內部網絡上的任何HTTP/HTTPS代理?在大多數情況下,這將是 HTTP - http://proxy.companydomain:8080 HTTPS - https://proxy.companydomain:8080
  2. 找到Renviron.site文件。一個我的Windows 10,我找到它在C:\Users\yourid\Documents\R\R-3.4.3\etc。在Linux中它有所不同。
  3. 使用文本編輯器打開Renviron.site並粘貼您的代理。保存文件並重新啓動[R

    options(Internet.info = 0) 
    http_proxy=http://proxy.companydomain:8080/ 
    https_proxy=https://proxy.companydomain:8080/ 
    
  4. 就我而言,我設置了代理,這是unsupported proxy ....libcurl is built without the HTTPS-proxy support.後有另一個錯誤。因此,我將第二行改爲http://而不是https://。這工作沒有任何錯誤。

    https_proxy=http://proxy.companydomain:8080/ 
    

    希望這有助於。設置代理有點容易,讓事情自動化。