我是R的新手,我只是试着通过一些教程。
当我尝试安装ggplot2时,会发现这个错误。
Error in library(ggplot2) : There is no package called 'ggplot2'我在R和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")得到的信息。
> 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文件,然后再次尝试安装。这是我的结果。
> 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’这些代码使用R3.4.2运行
发布于 2017-10-17 07:24:32
在提出这一问题时,我建议:
发布于 2018-02-25 09:12:07
步骤
ggplot2发布于 2018-11-23 22:18:44
尝试从命令提示符直接启动R客户机,然后发出指令: lib="C:/Users/YourUser/Documents/R/win-library/3.3") (“ggplot2”,ggplot2)
https://stackoverflow.com/questions/46773476
复制相似问题