本文介绍了安装ggp​​lot“包”ggplot'不可用“和”下标越界“错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ 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

推荐答案

您的包名称错误 - 现在 ggplot2 在Hadley几年前的一次重大改写之后,我假设旧的 ggplot 包已经从CRAN中删除。

You have the name of the package wrong - it is now ggplot2 following a major rewrite by Hadley some years ago. I presume the old ggplot package has been removed from CRAN.

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

这就是我get:

This is what I get:

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’

这篇关于安装ggp​​lot“包”ggplot'不可用“和”下标越界“错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 23:52