I am trying to use leaflet
and DT
in flexdashboard
using crosstalk
. I was able to run the data in flexdashboard using the below script. Now, i am looking to create a fullscreen option on the leaflet
section which i am not able to do.Also my aim is to select the data on leaflet and have the selected data to be reflected on the DT table, which is currently working. but i want to export the selected data onto a CSV document? which i am not able to do. Please help !
Bleow is my dataset
Date Hour Descr lat lng Final.Assessment
1/6/16 13 Paid -37.81550 145.0128 Paid in person
1/6/16 13 Paid -37.81550 145.0128 Paid in person
1/6/16 13 upaid -37.81550 145.0128 Not in contact
1/6/16 16 Paid -37.81760 144.9920 Paid in person
1/6/16 17 Paid -37.81127 144.9963 Paid via Online
1/6/16 17 loss -37.81127 144.9963 Bad product sold`
My flexdashboard script
`---
title: "Connecting Map and DT"
output:
flexdashboard::flex_dashboard:
output: html
library(leaflet)
library(tidyverse)
library(dplyr)
library(crosstalk)
library(flexdashboard)
library(DT)
library(htmlwidgets)
library(htmltools)
Column {data-width=650}
Chart A
newdata<-read.csv("datafile.csv")
shared_df<-SharedData$new(newdata)
leaflet(shared_df) %>%
addTiles() %>%
addMarkers()
Column {data-width=500}
Chart B
datatable(shared_df)
datatable(shared_df, extensions="Scroller", style="bootstrap", class="compact", width="100%",
options=list(deferRender=TRUE, scrollY=300,scroller=TRUE, buttons = c('copy', 'csv', 'excel', 'pdf', 'print')))
`