下面是根据主题计数加载美国地图的代码: 第一次加载地图时(左图)未正确加载。但是在按下提交后(基于有/没有用户输入)计数正确加载(右图)
我第一次无法弄清楚为什么计数没有正确加载。需要帮忙。
mapPlot <- reactive({
map_us = plot_usmap(data = values$map_data,
regions = "states",
values = "topic_location") +
scale_fill_continuous(
low = "white", high = "blue",
name = "Topic Location",
label = scales::comma) +
theme(legend.position = "right")
})
##### After submit code below:
tryCatch({
values$reports <- tmp
values$map_data <- get_state_map("", input, tmp)
values$map_data$state <- gsub(",.*$", "", values$map_data$state)
}, error = function(msg) {
showModal(
modalDialog(
title = "No Results",
"This search yielded no results. Please try a different search."
)
)
})
各州的主题计数