2016-10-16 85 views
0

我最近刪除了幾個R包(使用remove.packages()),並重新安裝了它們的最新版本。我試着用下面的語法重新安裝庫網:ggplot2命名空間加載失敗,網格描述失敗

url <- "https://cran.r-project.org/src/contrib/Archive/grid/grid_0.7-4.tar.gz" 
pkgFile <- "grid_0.7-4.tar.gz" 
download.file(url = url, destfile = pkgFile) 
install.packages(pkgs=pkgFile, type="source", repos=NULL) 
unlink(pkgFile) 

我收到了以下警告和錯誤:

Error : Invalid DESCRIPTION file 

Invalid package name. 
This is the name of a base package. 

See section 'The DESCRIPTION file' in the 'Writing R Extensions' 
manual. 

ERROR: installing package DESCRIPTION failed for package ‘grid’ 
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/grid’ 
Warning in install.packages : 
    installation of package ‘/Users/lindz/RNASeqVisualization/grid_0.7-4.tar.gz’ had non-zero exit status 

看來現在電網是基礎R的一部分,所以我暫時繼續前進。然而,在重新安裝使用包GGPLOT2:

install.packages("ggplot2") 

我收到以下警告:

Warning in install.packages : 
    URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES.gz': status was '400 Bad Request' 

Warning in install.packages : 
    URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES': status was '400 Bad Request' 
Warning in install.packages : 
    unable to access index for repository https://R-Forge.R-project.org/src/contrib: 
    cannot download all files 

Warning in install.packages : 
    URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES.gz': status was '400 Bad Request' 

Warning in install.packages : 
    URL 'https://R-Forge.R-project.org/src/contrib/PACKAGES': status was '400 Bad Request' 
Warning in install.packages : 
    unable to access index for repository https://R-Forge.R-project.org/src/contrib: 
    cannot download all files 
Warning in install.packages : 
    dependency ‘grid’ is not available 
Warning in install.packages : 
    unable to access index for repository https://www.stats.ox.ac.uk/pub/RWin/bin/macosx/mavericks/contrib/3.3: 
    Line starting '<!DOCTYPE html> ...' is malformed! 
Warning in install.packages : 
    URL 'http://www.omegahat.net/R/bin/macosx/mavericks/contrib/3.3/PACKAGES.gz': status was '404 Not Found' 
Warning in install.packages : 
    URL 'http://www.omegahat.net/R/bin/macosx/mavericks/contrib/3.3/PACKAGES': status was '404 Not Found' 
Warning in install.packages : 
    unable to access index for repository http://www.omegahat.net/R/bin/macosx/mavericks/contrib/3.3: 
    cannot download all files 
Warning in install.packages : 
    URL 'https://R-Forge.R-project.org/bin/macosx/mavericks/contrib/3.3/PACKAGES.gz': status was '400 Bad Request' 
Warning in install.packages : 
    URL 'https://R-Forge.R-project.org/bin/macosx/mavericks/contrib/3.3/PACKAGES': status was '400 Bad Request' 
Warning in install.packages : 
    unable to access index for repository https://R-Forge.R-project.org/bin/macosx/mavericks/contrib/3.3: 
    cannot download all files 
Warning in install.packages : 
    URL 'https://www.rforge.net/bin/macosx/mavericks/contrib/3.3/PACKAGES.gz': status was '404 Not Found' 
Warning in install.packages : 
    URL 'https://www.rforge.net/bin/macosx/mavericks/contrib/3.3/PACKAGES': status was '404 Not Found' 
Warning in install.packages : 
    unable to access index for repository https://www.rforge.net/bin/macosx/mavericks/contrib/3.3: 
    cannot download all files 

當我然後跑:

library(ggplot2) 

我收到的錯誤:

Error : package ‘grid’ does not have a namespace 
Error: package or namespace load failed for ‘ggplot2’ 

我不確定wha在這一點上做。我看過類似的帖子(R error package grid does not have a namespace),但他們的解決方案不適用於我的。我沒有網格保存在我的任何庫中,因爲我已經卸載它(使用remove.packages())。

我sessionInfo()如下:

R version 3.3.1 (2016-06-21) 
Platform: x86_64-apple-darwin13.4.0 (64-bit) 
Running under: OS X 10.9.5 (Mavericks) 

locale: 
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

other attached packages: 
[1] ggenealogy_0.2.0 

loaded via a namespace (and not attached): 
[1] rsconnect_0.4.3 tools_3.3.1 

任何意見將非常感謝!

回答

1

grid是一個紅鯡魚,它帶有R,無需嘗試並重新安裝它(否則更新R本身)。

ggplot2你應該從CRAN或github安裝,而不是R-forge。嘗試一個CRAN存儲庫。

+0

謝謝你的幫助。我現在嘗試install.packages(「ggplot2」,repos ='http://cran.us.r-project.org')。這隻給了我一個警告:「依賴'網格'不可用」。但是,當我再次執行庫(ggplot2)時,我收到了相同的兩個錯誤(「錯誤:程序包'網格'沒有命名空間 錯誤:程序包或名稱空間加載失敗'ggplot2'」) – LanneR

+1

嘗試重新安裝R的新副本,並且如果你有'.Rprofile',請註釋掉。 – baptiste