安装ggp​​lot“package'ggplot'不可用”和“下标超出界限”错误

时间:2011-04-02 11:22:16

标签: r ggplot2

$ 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

2 个答案:

答案 0 :(得分:22)

你有一个错误的包的名字 - 几年前Hadley重大改写之后现在是ggplot2。我认为旧的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’

答案 1 :(得分:0)

作为更新,如果有人遇到运行ggplot或GGally的问题,我会遇到此错误:

  

”错误:“ ggplot2”中的程序包或名称空间加载失败   loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):   没有名为“ colorspace”的程序包

     

错误:无法加载软件包“ ggplot2””

一旦我安装了色彩空间,ggplot2就可以正常工作。我猜想色彩空间在调用中,但不在列出的依赖项中。