Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.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
R 全部输入_R_If Statement_Shiny_Leaflet_Selectinput - Fatal编程技术网

R 全部输入

R 全部输入,r,if-statement,shiny,leaflet,selectinput,R,If Statement,Shiny,Leaflet,Selectinput,我有一张地图,我需要过滤掉土著和非土著人。但我也需要过滤掉所有土著和非土著人。我正在使用selectinput filtered <- reactive({ filter(places_df,INDIGENA == input$INDIGENA) if(input$INDIGENA =='ALL') places_df }) output$MapPlot1 <- renderLeaflet({ leaflet(data

我有一张地图,我需要过滤掉土著和非土著人。但我也需要过滤掉所有土著和非土著人。我正在使用selectinput

filtered <- reactive({
      filter(places_df,INDIGENA == input$INDIGENA)

if(input$INDIGENA =='ALL')
places_df

    })

    output$MapPlot1 <- renderLeaflet({
      
        leaflet(data =  filtered())%>% 
        setView(-51.127166, -4.299999, 10)%>%  
        addTiles()%>%
        addMarkers(popup = paste0(places_df$ID.GRUPO.FAMILIAR, "</br>", places_df$LOCALIDADES))
    
    })
    
    
    observe(
      leafletProxy("MapPlot1", data = filtered ())%>%  
        clearMarkers()%>%  
        addMarkers(popup = paste0(places_df$ID.GRUPO.FAMILIAR, "</br>", places_df$LOCALIDADES))
      )
    
filtered%
addTiles()%>%
addMarkers(弹出窗口=paste0(places_-df$ID.GRUPO.known,“
”,places_-df$LOCALIDADES)) }) 观察( 传单代理(“MapPlot1”,数据=filtered())%>% clearMarkers()%>% addMarkers(弹出窗口=paste0(places_-df$ID.GRUPO.known,“
”,places_-df$LOCALIDADES)) )
与函数类似,反应导体返回其主体的最后一条语句。如果
input$INDIGENA
不等于
'ALL'
,则语句

  if(input$INDIGENA == 'ALL'){
    places_df
  }
计算结果为
NULL

尝试:


你的问题到底是什么?你面临的问题是什么?另外,您能创建一个可复制的示例吗?地图没有加载,我认为这是由于使用了if。我需要帮助,如果它可能是if,或者我们所知道的可能是你不调用对象。因此需要一个可复制的示例。我在执行时添加了一个与地图照片的链接。。。请注意,地图并没有加载,我想这是因为如果…一个可复制的示例实际上包含自己运行的数据和代码。
filtered <- reactive({
  if(input$INDIGENA == 'ALL'){
    places_df
  }else{
    filter(places_df,INDIGENA == input$INDIGENA)
  }
})