Skip to content

Instantly share code, notes, and snippets.

@padamson
Created December 28, 2016 13:13
Show Gist options
  • Save padamson/2ef0feeffb0cef8a7b15f2cd83d7d728 to your computer and use it in GitHub Desktop.
Save padamson/2ef0feeffb0cef8a7b15f2cd83d7d728 to your computer and use it in GitHub Desktop.
Reactive acronym list with renderDataTable, timevis, and Shiny
output$acronyms <- DT::renderDataTable({
firstDate <- input$timelineGroups_window[1]
lastDate <- input$timelineGroups_window[2]
data <- input$timelineGroups_data %>%
select(label,start,end) %>%
filter((is.na(end) & (start > firstDate & start < lastDate)) |
(!is.na(end) & (start < lastDate & end > firstDate)))
acronyms %>%
filter(grepl(
paste(unlist(str_split(data$label,pattern=" ")),collapse="|"),
acronym)) %>%
select(acronym, full)
},
options = list(
paging = FALSE,
order = list(list(1, 'asc')),
rownames = FALSE,
columnDefs = list( list(visible=FALSE,targets=0) ),
colnames = c("Acronym","")
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment