ggplot2无法在R 3.0.2

时间:2015-06-04 06:39:29

标签: r ggplot2 plyr

我无法在Ubuntu上的R 3.0.2中安装ggp​​lot2。

当我跑步时

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

我收到以下错误。

 > install.packages('ggplot2',dependencies = TRUE)
Installing package into ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependencies ‘plyr’, ‘testthat’ are not available
also installing the dependencies ‘reshape2’, ‘scales’, ‘Hmisc’

trying URL 'http://cran.rstudio.com/src/contrib/reshape2_1.4.1.tar.gz'
Content type 'application/x-gzip' length 34693 bytes (33 Kb)
opened URL
==================================================
downloaded 33 Kb

trying URL 'http://cran.rstudio.com/src/contrib/scales_0.2.4.tar.gz'
Content type 'application/x-gzip' length 40093 bytes (39 Kb)
opened URL
==================================================
downloaded 39 Kb

trying URL 'http://cran.rstudio.com/src/contrib/Hmisc_3.16-0.tar.gz'
Content type 'application/x-gzip' length 629536 bytes (614 Kb)
opened URL
==================================================
downloaded 614 Kb

trying URL 'http://cran.rstudio.com/src/contrib/ggplot2_1.0.1.tar.gz'
Content type 'application/x-gzip' length 2351203 bytes (2.2 Mb)
opened URL
==================================================
downloaded 2.2 Mb

ERROR: dependency ‘plyr’ is not available for package ‘reshape2’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/reshape2’
    Warning in install.packages :
      installation of package ‘reshape2’ had non-zero exit status
    ERROR: dependency ‘plyr’ is not available for package ‘scales’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/scales’
    Warning in install.packages :
      installation of package ‘scales’ had non-zero exit status
    ERROR: dependencies ‘plyr’, ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/ggplot2’
    Warning in install.packages :
      installation of package ‘ggplot2’ had non-zero exit status
    ERROR: dependencies ‘ggplot2’, ‘scales’ are not available for package ‘Hmisc’
    * removing ‘/home/gowthamn/R/x86_64-pc-linux-gnu-library/3.0/Hmisc’
    Warning in install.packages :
      installation of package ‘Hmisc’ had non-zero exit status

我也试过

install.packages(c('reshape2','scales'))

获取plyr不可用的错误。

我还升级了Ubuntu并重新安装了最新版本的R并使用update.packages(checkBuilt=TRUE)更新了软件包。 但是,没有任何效果。我该怎么办?

5 个答案:

答案 0 :(得分:14)

如果您不需要最新版本,可以使用以下命令安装Ubuntu分发的打包版本:

sudo apt-get install r-cran-ggplot2

答案 1 :(得分:9)

我通过输入以下命令解决了这个问题:

if (!parametersFile) {
  sampleParameters = {
    tenant : '<tenant_id>',
    authorityHostUrl : 'https://login.microsoftonline.com',
    clientId : '<AD_application_client_id>',
    clientSecret : '<client_secret_key>'
  };
}

var authorityUrl = sampleParameters.authorityHostUrl + '/' + sampleParameters.tenant;

// var resource = '00000002-0000-0000-c000-000000000000';
var resource = 'https://graph.microsoft.com/';

答案 2 :(得分:4)

您应该将R版本(r-base)更新为最新版本。 命令行如:

$ sudo apt-get update
$ sudo apt-get install r-base

更新并没有为我工作。

答案 3 :(得分:2)

apt-get跟踪在/etc/apt/sources.list中查找包的库。大多数人的sources.list中定义的默认设置不包括CRAN镜像。对于Ubuntu用户,您可以将以下行添加到/etc/apt/sources.list:

deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <linux ver>/

我使用'可靠'的Ubuntu版本,更喜欢berkley cran镜像,所以我的行看起来像:

deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu trusty/

如果您需要查找Ubuntu版本,请尝试运行:

lsb_release -a

现在,apt-get可以为您与CRAN镜像进行交互。享受!

答案 4 :(得分:1)

从[http://cran.es.r-project.org/bin/linux/ubuntu/trusty/]下载最新版本的r-base(3.2.2) 使用Ubuntu软件中心打开并安装。 这会将您已安装的版本更新为最新版本。然后再次尝试安装ggp​​lot2行李。它像魔术一样对我有用。 祝它好运!!