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

GaB*_*lya 8 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
Run Code Online (Sandbox Code Playgroud)

我该如何安装ggplot

Rei*_*son 26

你有一个错误的包名 - 它现在ggplot2是几年前Hadley重大改写之后.我认为旧的ggplot包已从CRAN中删除.

install.packages("ggplot2", dependencies = TRUE)
Run Code Online (Sandbox Code Playgroud)

这就是我得到的:

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’
Run Code Online (Sandbox Code Playgroud)

  • @GaBorguly它有点慢下来,自己有点耐心.我展示的代码有效,但是当你尝试它时失败了.在这一点上退后一步,看看你使用的是什么和工作代码的作用有什么不同. (5认同)
  • @GaBorguly-我非常冷静。关于您为什么更改我的代码并发布另一个问这个问题的消息,我有些疑惑吗?但不要为此感到生气,生气或压力。我为此感到宿醉!;-) (2认同)