-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.R
31 lines (24 loc) · 672 Bytes
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
library(shiny)
library(leaflet)
library(sf)
r_colors <- rgb(t(col2rgb(colors()) / 255))
names(r_colors) <- colors()
ui <- fluidPage(
leafletOutput("pctShinyMap"),
p(),
actionButton("recalc", "New lines")
)
server <- function(input, output, session) {
source("code/load-data.R")
lines <- eventReactive(input$recalc, {
rf[sample(x = nrow(rf), size = 10),]
}, ignoreNULL = FALSE)
output$pctShinyMap <- renderLeaflet({
leaflet() %>%
addProviderTiles(providers$Stamen.TonerLite,
options = providerTileOptions(noWrap = TRUE)
) %>%
addPolylines(data = lines(), color = "red")
})
}
shinyApp(ui, server)