Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
交互式choropleth地图,带R和传单_R_Shiny_Leaflet - Fatal编程技术网

交互式choropleth地图,带R和传单

交互式choropleth地图,带R和传单,r,shiny,leaflet,R,Shiny,Leaflet,我正在尝试创建一个闪亮的应用程序,在这里我可以选择要绘制到地图中的值。这可能是一个非常简单的任务,但我是新来的闪亮,我无法理解它 我不知道我是否必须使用selectInput,或者传单是否有不同的方式与Shiny互动 这是我的密码 library(RColorBrewer) library(rgdal) library(shiny) pal <- colorQuantile("YlGn", NULL, n = 5) state_popup <- paste0("<stro

我正在尝试创建一个闪亮的应用程序,在这里我可以选择要绘制到地图中的值。这可能是一个非常简单的任务,但我是新来的闪亮,我无法理解它

我不知道我是否必须使用selectInput,或者传单是否有不同的方式与Shiny互动

这是我的密码

library(RColorBrewer)
library(rgdal)
library(shiny)


pal <- colorQuantile("YlGn", NULL, n = 5)

state_popup <- paste0("<strong>State: </strong>", 
                      africa$COUNTRY, 
                      "<br><strong>Resource Revenue(IMF)</strong>", 
                      africa$Africa_r_1)

leaflet_africa <- leaflet(data = africa) %>%
  addProviderTiles("CartoDB.Positron") %>%
  addPolygons(fillColor = ~pal(Africa_r_1), 
              fillOpacity = 0.8, 
              color = "#BDBDC3", 
              weight = 1, 
              popup = state_popup)



ui <- fluidPage(
  leafletOutput("map1")
  )


server <- function(input, output, session) {

  output$map1 <- renderLeaflet({
    leaflet_africa
  })
}

shinyApp(ui = ui, server = server)
库(RColorBrewer)
图书馆(rgdal)
图书馆(闪亮)
pal%
addPolygons(fillColor=~pal(Africa_r_1),
填充不透明度=0.8,
color=“#BDBDC3”,
重量=1,
弹出=状态(弹出)

ui是
africa
公开的数据集吗?或者您可以将其
dput
部分添加到您的问题中吗?