[R-sig-Geo] leaflet in shiny error message

Bede-Fazekas Ákos b|@|ev||@t @end|ng |rom gm@||@com
Mon Jan 3 09:22:19 CET 2022


Dear Basile,

the %>% operator is accidentally commented out! Change
fillOpacity = 0.7)#%>%
to
fillOpacity = 0.7) %>%
and then setView() will get its first parameter called "map".

HTH,
Ákos Bede-Fazekas
Centre for Ecological Research, Hungary

2022.01.03. 1:49 keltezéssel, basile.lenormand via R-sig-Geo írta:
> Hello everyone!
>
> I am trying to create a shiny app with leaflet stuff in it. I have a problem when I am displaying the application, I got this error message :
>
> "Error in dispatch: argument "map" is missing, with no default".
>
> I searched some clues on the net, I found some examples which are working but I do not get where I going wrong. I double checked the brackets, try to change the name of the map, put the name of the spatial data frame that I am using, etc.
>
> If someone can give me some clues I will be really glad.
> Have a great day,
> thank you for your time,
> Basile.
>
> Here is my code:
>
> ui <- fluidPage(
> titlePanel(""),
>
> sidebarLayout(
> sidebarPanel(
> helpText(""),
>
> selectInput("var",
> label = "Choose a variable to display",
> choices = spdf$koppen,
> selected = ""
> ),
> sliderInput("range", "surface brûlée en hectare", min(spdf$V11), max(spdf$V11),
> value = range(df$V11), step = 2500
> ),
> sliderInput("range", "Nombre d'incendie", min(spdf$n), max(spdf$n),
> value = range(df$V11), step = 2
> ),
> checkboxInput("legend", "Show legend", TRUE)),
> mainPanel(leafletOutput("map"))
> )
> )
>
> server <- function(input, output, session) {
> output$map <- renderLeaflet({
> leaflet(df) %>%
> addTiles(group = "OSM") %>%
> addProviderTiles("Esri.NatGeoWorldMap", group="ESRI") %>%
> addProviderTiles("CartoDB.DarkMatter", group= "CartoDB") %>%
> #fitBounds(~min(long), ~min(lat), ~max(long), ~max(lat))%>%
> addPolygons(
> data=spdf,
> fillColor = "viridis",
> weight = 0,
> opacity = 1,
> color = "white",
> dashArray = "3",
> fillOpacity = 0.7)#%>%
> setView(lat= 44.2, lng=5.9, zoom=5)
> })
> }
> shinyApp(ui, server)
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list