Skip to content

Instantly share code, notes, and snippets.

@nlddfn nlddfn/Observer_Server.R

Last active Aug 7, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.