在Shiny中渲染反应性传单对象

时间:2017-06-29 12:48:28

标签: r shiny leaflet shiny-reactivity

我正在构建一个闪亮的应用程序,我的UI中有一个名为Florida_leaflet的leafletOutput。

在我的服务器中,我有

   my_leaflet <- reactive({


if (input$speciesSelect == "ACR CERV" & input$yearSelect == "2016")

{
  my_leaflet <- sites%>%removeLayersControl()%>% addLayersControl(
     baseGroups = c("satellite"),
     position = "topleft",
     overlayGroups = c("Florida survey sites", "FKNMS Boundary"),
     options = layersControlOptions(collapsed = FALSE))  %>%
    addCircleMarkers(data = subset(SEFCRI2014_demo_data, CORAL_CD == "ACR CERV"), group = "Florida survey sites", lat = ~LAT_DEGREES, 
     lng = ~LON_DEGREES, radius = ~6,  color = "#F0E442", stroke = FALSE, fillOpacity = 1)
}

 else {
    my_leaflet <- sites%>%removeLayersControl()%>% addLayersControl(
     baseGroups = c("satellite"),
     position = "topleft",
     overlayGroups = c("Florida survey sites", "FKNMS Boundary"),
     options = layersControlOptions(collapsed = FALSE)) 
 }
 my_leaflet

                       })

output$Florida_leaflet <- renderLeaflet(my_leaflet())

其中sites是一个传单对象。

现在,当我使用renderLeaflet(网站)时,应用程序运行正常,但运行上面的代码,我收到错误:

Error in c: unused argument ("satellite")Stack trace (innermost first):
    105: evalAll
    104: evalFormula
    103: invokeMethod
    102: addLayersControl
    101: function_list[[k]]
    100: withVisible
     99: freduce
     98: _fseq
     97: eval
     96: eval
     95: withVisible
     94: %>%
     93: <reactive:my_leaflet> [#35]
     82: my_leaflet
     81: func
     80: origRenderFunc
     79: output$Florida_leaflet
      4: <Anonymous>
      3: do.call
      2: print.shiny.appobj
      1: <Promise>

为什么会发生这种情况的任何想法?提前致谢

0 个答案:

没有答案