0

I am very new to shiny and the mapping function. Based on the code of the link bellow, I did a simple one, which does not work. Can someone tell me why is not working? There is no error shown. However, it doesn't show the map.

I am working with the dataset of NYC bikes.

library(shiny)
library(leaflet)

bikes <- read.csv("Data/201501-citibike-tripdata.csv")

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

server <- function(input, output) {
  
  output$mymap <- renderLeaflet({
    leaflet(bikes) %>% 
      setView(lng = -73.98928, lat = 40.75042, zoom = 10) #NYC
    
  })
  
}

shinyApp(ui=ui, server = server)

link: http://rstudio-pubs-static.s3.amazonaws.com/133599_c0d5471268584d47b53298f0ad27e8d3.html

3
  • 1
    You are missing addProviderTiles("CartoDB.Positron", options = providerTileOptions(noWrap = TRUE))
    – YBS
    Commented Jan 30, 2021 at 17:05
  • Thanks a lot @YBS. One more question about this topic! By adding ` addMarkers( lng=~start.station.longitude, lat=~start.station.latitude )` should then appear the markers from my df, shouldn't they?
    – icatalan
    Commented Jan 31, 2021 at 12:39
  • You could also try addCircleMarkers()
    – YBS
    Commented Jan 31, 2021 at 13:15

0

Browse other questions tagged or ask your own question.