Hello, I'm trying to make a reactive table using shiny where you can select which columns are included in the table. Here is the code I have so far. The table I'm using my data from is called "joined". Thanks!
Here is the error message I get:
unable to find an inherited method for function ‘select’ for signature ‘"data.frame", "character"’
install.packages("DT")
library(shiny)
library(DT)
library(shinyWidgets)
library(dplyr)
require(SparkR)
sparkR.init()
ui <- fluidPage(
titlePanel("title"),
sidebarLayout(
sidebarPanel(
uiOutput("picker"),
actionButton("view", "View selection"))),
mainPanel(ui <-
tableOutput("mytable"),
)
)
server <- function(input, output, session) {
data <- reactive({
joined
})
output$picker <- renderUI({
pickerInput(inputId = 'pick',
label = '3. Choose variables',
choices = colnames(data()),
options = list(`actions-box` = TRUE), multiple = TRUE)
})
datasetInput <- eventReactive(input$view,{
datasetInput <- data() %>%
select(input$pick)
return(datasetInput)
})
output$mytable <- renderTable({
datasetInput()
})
}