我试图使用以下内容创建地图:
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)
由于没有答案,而且我看了这篇文章很长时间,也不清楚,所以我会发布帮助我克服这个错误的内容。我以前运行过我的脚本,它运行得很好,所以我不认为这是环境或安装问题。我的问题是,我之前的Rstudio会话中有从我在该会话中运行的脚本加载的库,而不一定是在我调用st_read((的脚本中。当我在一个新会话中重新加载脚本并尝试运行st_read((时,它显然不是来自sf库(它是从另一个脚本加载的(。希望这对其他人有帮助;
st_read((只有在sf库加载后才可用。