{{ env_id }} <- readRDS(file.path(datadir, "{{ env_id }}.rds")) is_shiny <- identical(knitr::opts_knit$get("rmarkdown.runtime"), "shiny") library(magrittr)
# # Handle event data from transmitter # output${{ env_id }} <- renderPrint({ eventdata <- plotly::event_data({{ env_id }}$event, source = {{ env_id }}$transmitter) eventdata[, c("x", "y", "key")] }) # # Download data.frame # output$downloadData_{{ env_id }} <- downloadHandler( filename = paste('data-', Sys.Date(), '.csv', sep=''), content = function(file) { df <- plotly::event_data({{ env_id }}$event, source = {{ env_id }}$transmitter) write.csv(df[, c("x", "y", "key")], file) } ) # # Layout of component # shiny::fillCol(flex = c(NA, 1), downloadButton('downloadData_{{ env_id }}', 'Download data'), verbatimTextOutput("{{ env_id }}") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.