我正在尝试使用以下方法创建地图:
library(sf)
library(ggplot2)
library(ggthemes)
我一直无法显示,因为它一直在向我显示
library(sf)
Error: package or namespace load failed for ‘sf’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘classInt’
Además: Warning message: package ‘sf’ was built under R version 4.1.0
library(leaflet)
Error: package or namespace load failed for ‘leaflet’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘crosstalk’
Además: Warning message: package ‘leaflet’ was built under R version 4.1.0
estadosmx <- st_read('https://raw.githubusercontent.com/angelnmara/geojson/master/mexicoHigh.json')
Error in st_read("https://raw.githubusercontent.com/angelnmara/geojson/master/mexicoHigh.json") : no se pudo encontrar la función "st_read"
install.packages("st_read")
Installing package into ‘C:/Users/Jorge escobar/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)
Warning in install.packages : package ‘st_read’ is not available (for R version 4.0.2)
答案 0 :(得分:1)
由于没有答案,而且我看了这篇文章很长时间而且我不清楚,我会发布帮助我克服这个错误的内容。我之前运行过我的脚本并且运行良好,所以我不认为这是环境或安装问题。我的问题是因为我之前的 Rstudio 会话从我在该会话中运行的脚本加载了库,不一定是在我调用 st_read() 的脚本中。当我在新会话中重新加载我的脚本并尝试运行 st_read() 时,它来自 sf 库(从另一个脚本加载)并不明显。希望这对其他人有帮助;
st_read() 仅在 sf 库加载后可用。