Locations of Earthquakes off Fiji.
The data set give the locations of 1000 seismic events of MB > 4.0. The events occurred in a cube near Fiji since 1964. Credit: jcheng5 @rstudio.
library(crosstalk)
library(leaflet)
library(DT)
####
#### Example 1
# Wrap data frame in SharedData
sd <- SharedData$new(quakes[sample(nrow(quakes), 100),])
# Create a filter input
filter_slider("mag", "Magnitude", sd, column=~mag, step=0.1, width=250)
# Use SharedData like a dataframe with Crosstalk-enabled widgets
bscols(
leaflet(sd) %>% addProviderTiles("Stamen.Terrain") %>% addCircles(popup = ~ mag, color = "gold", fillColor = "darkblue", stroke = "gold"),
datatable(sd, extensions="Scroller", style="bootstrap", class="compact", width="100%",
options=list(deferRender=TRUE, scrollY=300, scroller=TRUE))
)
## Assuming 'long' and 'lat' are longitude and latitude, respectively
A scatter plot pairs Matirce for the Earth quake data from Fiji. Credit: Dr. John Woodhouse, Dept. of Geophysics, Harvard University.
require(graphics)
pairs(quakes, main = "Fiji Earthquakes, N = 1000", cex.main = 1.2, pch = ".")