无法使用ggplot2

问题描述 投票:0回答:1

尝试安装和使用ggplot2时出现以下错误

install.packages("ggplot2")

library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in
  loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
  vI[[j]]):  there is no package called ‘Rcpp’ In addition: Warning
  message: package ‘ggplot2’ was built under R version 3.4.3
r ggplot2 install.packages
1个回答
1
投票

请执行以下步骤

1)install.packages("Rcpp")

Installing package into ‘C:/Users/username/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.14.zip'
Content type 'application/zip' length 4358875 bytes (4.2 MB)
downloaded 4.2 MB

package ‘Rcpp’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  unable to move temporary installation ‘C:\Users\username\Documents\R\win-library\3.4\file173429377309\Rcpp’ to ‘C:\Users\username\Documents\R\win-library\3.4\Rcpp’

The downloaded binary packages are in
    C:\Users\username\AppData\Local\Temp\RtmpQJ4SRf\downloaded_packages

2)转到C:\ Users \ username \ AppData \ Local \ Temp \ RtmpQJ4SRf \ downloaded_pa​​ckages

3)将Rcpp_0.12.14.zip解压缩到C:\ Users \ username \ Documents \ R \ win-library \ 3.4

4)library(ggplot2)

© www.soinside.com 2019 - 2024. All rights reserved.