我是R的新手,我只是想尝试一些教程。
当我尝试安装ggplot2时,出现此错误。
Error in library(ggplot2) : There is no package called 'ggplot2'
Run Code Online (Sandbox Code Playgroud)
我在R和RStudio中尝试了这些。
install.packages("ggplot2", dep=T)
install.packages('ggplot2', repos='http://cran.us.r-project.org')
remove.packages("ggplot2")
Run Code Online (Sandbox Code Playgroud)
但我得到了错误
(Error in remove.packages : there is no package called 'ggplot2')
Run Code Online (Sandbox Code Playgroud)
这就是我从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 …Run Code Online (Sandbox Code Playgroud)