2011-04-02 39 views
6
$ R 
R version 2.12.2 (2011-02-25) 
Platform: i486-pc-linux-gnu (32-bit) 

> install.packages("ggplot") 
Warning message: 
In getDependencies(pkgs, dependencies, available, lib) : 
    package ‘ggplot’ is not available 

> install.packages("ggplot", dep="T") 
Error in apply(available[p1, dependencies, drop = FALSE], 1L, function(x) paste(x[!is.na(x)], : 
    subscript out of bounds 
In addition: Warning message: 
In getDependencies(pkgs, dependencies, available, lib) : 
    package ‘ggplot’ is not available 

> install.packages("ggplot", dep="T", type="source") 
Error in apply(available[p1, dependencies, drop = FALSE], 1L, function(x) paste(x[!is.na(x)], : 
    subscript out of bounds 
In addition: Warning message: 
In getDependencies(pkgs, dependencies, available, lib) : 
    package ‘ggplot’ is not available 

如何安裝ggplot安裝ggp​​lot「包」ggplot'不可用「和」下標越界「錯誤

回答

18

您的包裝名稱錯誤 - 現在是ggplot2,在Hadley幾年前進行了重大改寫之後。我認爲舊的ggplot包已從CRAN中刪除。

install.packages("ggplot2", dependencies = TRUE) 

這就是我得到:

R> install.packages("ggplot2", dependencies = TRUE) 
Installing package(s) into ‘/home/gavin/R/libs’ 
(as ‘lib’ is unspecified) 
trying URL 'http://cran.uk.r-project.org/src/contrib/ggplot2_0.8.9.tar.gz' 
Content type 'application/x-gzip' length 2074749 bytes (2.0 Mb) 
opened URL 
================================================== 
downloaded 2.0 Mb 

* installing *source* package ‘ggplot2’ ... 
** R 
** data 
** moving datasets to lazyload DB 
** inst 
** help 
*** installing help indices 
** building package indices ... 
** testing if installed package can be loaded 

* DONE (ggplot2) 

The downloaded packages are in 
    ‘/tmp/RtmpPcn8bl/downloaded_packages’ 
+0

如果您還沒有安裝,那麼你會看到很多比我上面顯示的依賴關係。 – 2011-04-02 11:34:59

+0

謝謝!請參閱我的後續問題:http://stackoverflow.com/questions/5522924/installing-ggplot-subscript-out-of-bounds-error。 – GaBorgulya 2011-04-02 11:42:14

+0

@GaBorgulya你真的應該編輯現有的Q來發布類似的後續Q,而不是啓動一個新的。如果你運行的代碼我顯示它會工作。如果你想改變工作代碼,那麼當它破裂時不要感到驚訝。 – 2011-04-02 11:50:33