在R(v3.2.2)中安装ggp​​lot2; 说它已安装但无法找到/使​​用?

Ral*_* L. 0 r ggplot2 install.packages

我在R中安装ggp​​lot2软件包时遇到问题.根据R-studio,我安装了最新版本; 这是R studio首次加载时的说法:

R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
Run Code Online (Sandbox Code Playgroud)

我假设这意味着我正在使用正确的版本.但是,当我尝试使用install.packages("ggplot2")命令安装ggp​​lot2包时,我收到以下错误(必须在pastebin中发布,因为它包含链接):

http://pastebin.com/deqn0vFw

It appears to be some kind of error with my internet connection (not sure how to fix it, googling didn't seem to give a concrete answer). After I got that error, I went ahead and just tried downloading the .zip file for ggplot2 from the official CRAN website. Then, in R-Studio I went ahead and went to Tools>Install Packages and just installed it from the .zip. Then, in the console it said

> install.packages("C:/Users/ralei/Downloads/ggplot2_1.0.1.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/ralei/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
package ‘ggplot2’ successfully unpacked and MD5 sums checked
Run Code Online (Sandbox Code Playgroud)

But then when I call the ggplot2 library using the library(ggplot2) I get the error:

> library(ggplot2)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
Run Code Online (Sandbox Code Playgroud)

there is no package called 'digest’

After going ahead and installing the 'digest' package (again through the CRAN website), I got another error when I tried to load ggplot2.

 > library(ggplot2)
 Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
   there is no package called ‘gtable’
 Error: package or namespace load failed for ‘ggplot2’
Run Code Online (Sandbox Code Playgroud)

Can anybody explain to me what I'm doing wrong?

Thanks.

编辑:这被标记为"如果您的包不可用该怎么办"的重复错误问题,但我不知道我的问题是如何重复 - 我没有得到"包不可用"因为我可以手动安装它,但似乎当我安装ggp​​lot2时,安装似乎并没有"坚持".

小智 6

尝试使用运行此代码..

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

如果您仍然面临问题,请确保从以下网站单独安装依赖项("plyr","digest","gtable","reshape2","scale","proto","MASS"等)https:/ /cran.rstudio.com/ 并检查安装文件是否在目录C:\ Users\Sahidul.Islam\Documents\R\win-library\3.2中解压缩. 在此输入图像描述

如果仍然无法升级R软件和所有软件包(可以通过单击R Software菜单栏中的"软件包"+"升级软件包..."来升级软件包.