library(leaflet)
library(maps)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(shiny)
data(world.cities)
ui <- fluidPage(
leafletOutput("mymap")
)
server <- function(input, output, session){
output$mymap <- renderLeaflet(
{
leaflet(world.cities %>%
dplyr::filter(
country.etc=="USA",
pop > 1000000
)
) %>%
addTiles() %>%
addMarkers(lat = ~lat, lng = ~long, popup = ~name)
}
)
}
shinyApp(ui, server)
## PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.
Shiny applications not supported in static R Markdown documents