无法在我的Shiny应用程序中加载geojson文件。我们遇到了麻烦,发现即使将所有代码都编辑掉,库(rgdal)和库(geojsonio)也不会载入。代码似乎不是问题-这是一个打包问题,geojson和rgdal不会加载到Shiny中。
编辑所有代码并仅运行软件包。包装是问题所在。删除rgdal和geojsonio时,您可以运行软件包和服务器。我无法运行所有代码,因为它依赖于空间文件,并且您需要rgdal或geojsonio才能读入它。
library(shiny)
library(tidyverse)
library(data.table)
library(readxl)
library(shinydashboard)
library(rgdal)
library(leaflet)
mh.cleaned <- fread("CleanerMH1.csv")
population.data <-read_excel("PopulationCleanTotals.xlsx")
where.people.go <- mh.cleaned %>%
group_by(hnum2.name, dy, hsaname) %>%
summarize(count = n())
hsa.origin.counts <- mh.cleaned %>%
group_by(hsaname, dy) %>%
summarize(count = n())
colnames(hsa.origin.counts)[1] <- "HSA"
colnames(hsa.origin.counts)[2] <- "Year"
population.data$HSA <- recode(population.data$HSA,
"White River Jct" = "White River Jct.")
cases.per.capita <- left_join(hsa.origin.counts, population.data, by = c("HSA", "Year"))
prop.cases.per.capita <- cases.per.capita %>%
mutate(prop.cases = count/`Population Total`)
#Import the geo_json file
# vt.hsa <- geojson_read("vthsa.geojson",
# what = "sp")
vt.hsa <- readOGR("vthsa.geojson")
Warning in fun(libname, pkgname) :
rgeos: versions of GEOS runtime 3.5.1-CAPI-1.9.1
and GEOS at installation 3.5.0-CAPI-1.9.0differ
Error in value[[3L]](cond) :
package or namespace load failed for ‘geojsonio’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/opt/R/3.6.0/lib/R/library/rgdal/libs/rgdal.so':