尝试加载ggridges并显示“错误:包或名称空间加载失败”

时间:2020-04-26 21:35:09

标签: r ggplot2 qgis ggridges

我正在尝试使用QGIS和R创建Joy Division样式的高程图。但是,当我尝试加载库gplot2,ggridges和maproj时,ggridges出现错误:

library(ggplot2)
library(ggridges)
**Error: package or namespace load failed for ‘ggridges’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):**
**there is no package called ‘Rcpp’**
library(mapproj)
Loading required package: maps

我该如何解决?我正在使用的整个代码可以在下面找到:

https://pastebin.com/E2esXTad

load requisite packages
library(ggplot2)
library(ggridges)
library(mapproj)

# set your working directory
setwd("/Users/hleatherwood/Documents/Joy Divison Maps/Test/project")

# Import the Crater Lake transect data
CraterLake_80trwwansects <- read.csv(file="CraterLake_80transects.csv",
                                   header=TRUE, sep=",")

# view data frame and change column headers
head(CraterLake_80transects)
names(CraterLake_80transects)[1] <- "Elev"
names(CraterLake_80transects)[2] <- "Lon"
names(CraterLake_80transects)[3] <- "Lat"

# plot the transects with ggplot2 & ggridges
CraterLake_basic <- ggplot(CraterLake_80transects, 
                           aes(x = Lon, y = Lat, group = Lat, height = Elev)) + 
  geom_density_ridges(stat = "identity")

# Call the default plot variable
CraterLake_basic

0 个答案:

没有答案