i need to setView of leaflet map to new polygon add in the map:
    observeEvent(input$do, {
    shapeComuna = paste0("cl_",input$interval,"comunas_geo")
    archComuna = paste0("shapefiles/cl_",input$interval,"comunas_geo")
    comuna <- readOGR(dsn = archComuna, layer = shapeComuna)
    names(comuna)[1] <- "ID"
    shapeData2 <- spTransform(comuna, CRS("+proj=longlat +ellps=GRS80"))
    proxy <- leafletProxy("mymap") 
    proxy %>% clearShapes() %>%  addPolygons(
      data = shapeData2,
      smoothFactor = 0.3,
      fillOpacity = 0.45,
      stroke = TRUE,
      opacity = 1,
      weight = 1.8,
      popup = shapeData2$NOMBRE,
      layerId = shapeData2$ID,
      group = "Comunas"
    ) %>% setView()
})
When i click in input$do, clear all polygons and print the new one, but i can´t set the view of that new polygon dynamically.
Exist one form for searching that new polygon and set the view in him ? Or need to take one point of the shapefile and pass it to setView ?
 
    