R 3.4.2库(ggplot2)中的错误:没有名为"ggplot2"的软件包 [英] R 3.4.2 Error in library(ggplot2) : There is no package called 'ggplot2'
本文介绍了R 3.4.2库(ggplot2)中的错误:没有名为"ggplot2"的软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是R的新手,我只是想尝试一些教程.
I'm new to R and I'm just trying to get through some tutorials.
当我尝试安装ggplot2时,出现此错误.
When I try installing ggplot2, I get this error.
Error in library(ggplot2) : There is no package called 'ggplot2'
我在R和RStudio中尝试过这些.
I tried these in R and RStudio.
install.packages("ggplot2", dep=T)
install.packages('ggplot2', repos='http://cran.us.r-project.org')
remove.packages("ggplot2")
但是我得到了错误
(Error in remove.packages : there is no package called 'ggplot2')
这是我从install.packages("ggplot2")中获得的信息
This is what I get from install.packages("ggplot2")
> install.packages("ggplot2")
Installing package into ‘.../R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = ".../R/win-library/3.4"' is not writable
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/ggplot2_2.2.1.zip'
Content type 'application/zip' length 2784566 bytes (2.7 MB)
downloaded 2.7 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘ggplot2’
The downloaded binary packages are in
C:...\AppData\Local\temp\RtmpqaGNpr\downloaded_packages
我手动删除了所有ggplot2文件,然后尝试再次安装.这是我的结果.
I removed all ggplot2 files manually then tried to install again. Here's my result.
> install.packages("ggplot2")
Installing package into ‘.../R/win-library/3.4’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://ftp.osuosl.org/pub/cran/bin/windows/contrib/3.4/ggplot2_2.2.1.zip'
Content type 'application/zip' length 2784566 bytes (2.7 MB)
downloaded 2.7 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
Warning: unable to move temporary installation ‘...\R\win-library\3.4\file26b43a54980\ggplot2’ to ‘...\R\win-library\3.4\ggplot2’
The downloaded binary packages are in
C:...\AppData\Local\temp\Rtmpq0T9a6\downloaded_packages
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’
> library("ggplot2")
Error in library("ggplot2") : there is no package called ‘ggplot2’
>
推荐答案
遇到此问题时,我建议:
When having this issue I would suggest :
- 尝试将其关闭然后再次打开
- 尽可能将R更新到最新版本
- 手动删除与相关软件包相关的所有文件夹,然后重试安装
- 更改默认库位置:如何在以下位置更改库位置R?
- try turning it off and on again
- update R to last version if possible
- remove manually all the folders related to the relevant package and retry the installation
- change your default library location : How do you change library location in R?
这篇关于R 3.4.2库(ggplot2)中的错误:没有名为"ggplot2"的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文