@XiongbingJin's example on Stack Overflow allows the user first to display a full dataset and to second to change the columns to display with a checkboxGroupInput .
I would like some help to make something different :
What I want :
- datatable displaying begins with an arbitrary list of column (ex :
carb
,wt
,drat
ofmtars datset
) and not the full dataset. - The user can complete the list to display with the checkboxGroupInput. (ex: add
vs
).
@XiongbingJin example :
library(shiny)
runApp(list(
ui = basicPage(
selectInput("select", "Select columns to display", names(mtcars), multiple =
TRUE),
h2('The mtcars data'),
dataTableOutput('mytable')
),
server = function(input, output) {
output$mytable = renderDataTable({
columns = names(mtcars)
if (!is.null(input$select)) {
columns = input$select
}
mtcars[,columns,drop=FALSE]
})
}
))