library(shiny)
library(tidyverse)
library(data.table)
library(DT)
ui <- fluidPage(
selectInput(inputId="C1",label='filt1',choices=colnames(mtcars)),
selectInput(inputId="C2",label='filt2',choices=colnames(mtcars)),
DT::dataTableOutput("table1")
)
server<- function(input,output,session) {
data<-mtcars
setDT(data)
output$table1<-DT::renderDataTable({
data[,.(get(input$C1),get(input$C2)),]
#mtcars %>%
#select(input$C1,input$C2)
})
}
shinyApp(ui=ui,server=server)
For the data table ,why we need to add the get command where as for dplyr the same input$Col names works