Leaflet interactivity without Shiny in Rmarkdown - Answer to adi4196

The Topic came up here at this forum post from User adi4196.
It's closed now so I can no longer answer the old topic.

adi4196s questions was:

I'm trying to implement a leaflet map interactivity with a slider Input in Rmarkdown but without using shiny.
Any solutions or alternatives regarding the same?"

My answer is:
This is possible with the crosstalk library.
Take a look at this: crosstalk tutorial

Here is the code for the first interactive-map example of the linked tutorial:

Example Code
title: Fiji earthquakes
output: html_document


# 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
  leaflet(sd) %>% addTiles() %>% addMarkers(),
  datatable(sd, extensions="Scroller", style="bootstrap", class="compact", width="100%",
    options=list(deferRender=TRUE, scrollY=300, scroller=TRUE))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.