library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2 v purrr 0.3.4
## v tibble 3.0.4 v dplyr 1.0.2
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.0
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(leaflet)
library(DT)
library(crosstalk)
map <- read_csv("data/mockaroo_latlon.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## id = col_double(),
## Company = col_character(),
## Latitude = col_double(),
## Longitude = col_double()
## )
map
## # A tibble: 10 x 4
## id Company Latitude Longitude
## <dbl> <chr> <dbl> <dbl>
## 1 1 Ailane 40.2 72.1
## 2 2 Thoughtbeat -7.91 111.
## 3 3 Lazz 9.50 50.8
## 4 4 Zoomdog -7.03 108.
## 5 5 Minyx -17.0 -41.6
## 6 6 Devpulse 21.9 107.
## 7 7 Meembee 53.3 -6.22
## 8 8 Quamba 31.4 92.8
## 9 9 Realcube 30.3 120.
## 10 10 Fatz 14.1 123.
leaf_map <- map %>%
leaflet(width = "100%") %>%
addTiles() %>%
addMarkers(lat = ~Latitude,
lng = ~Longitude,
popup = ~Company)
leaf_map
mapdata_table <- datatable(map, extensions="Scroller", style="bootstrap", class="compact", width="100%",
options=list(deferRender=TRUE, scrollY=300, scroller=TRUE))
mapdata_table
make shared data structure
shared_map <- SharedData$new(map)
bscols(shared_leaf_map, shared_mapdata_table)