Skip to content

Instantly share code, notes, and snippets.

@nlddfn
Last active August 7, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nlddfn/bca353b840f1cadda92a042d7908e39f to your computer and use it in GitHub Desktop.
Save nlddfn/bca353b840f1cadda92a042d7908e39f to your computer and use it in GitHub Desktop.
Shiny_MIgration_paths_Server.R
observe({
# data frames
if(input$whichData == 'Daily Arrivals'){
data_stat = balkanRoute}
else if(input$whichData == 'Gender'){
data_stat = dataGender2016}
else {data_stat = dataOrigin2016}
# Column indexes
if(input$whichData == 'Daily Arrivals'){
col = col_balkanRoute}
else if(input$whichData == 'Gender'){
col = col_gender}
else {col = col_demography}
updateSelectInput(session, "selected", choices = col,
selected = col[1:min(4, length(col))]
)
# show data using DataTable
output$table <- renderDataTable({
datatable(data_stat[,input$selected], rownames=FALSE,selection = 'multiple') %>%
formatStyle(input$selected, background="skyblue", fontWeight='bold')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment