New to shiny, I'm currently building a basic app that acts people counter that updates a remote google sheet, I've narrowed down the problem to the function dataTableOutput()
and its returning: Error: argument is not interpretable as logical
I've scoured Shiny's function description site, as well as other (somewhat) related problems on here, and tutorials. The error code goes away when I remove it, but the app crashes, I've also made sure to update all packages and the version of R that I'm using. I'm also running it on anaconda's IDE.
fields <- c("Pool", "Table Tennis", "Arcade Games",
"Console Games", "Board Games", "Air Hockey",
"Cornhole")
Maindata <- c("date","semester", "games", "num")
semesters <- c("Spring", "Summer", "Fall")
ui <- fluidPage(
titlePanel("Corner Pocket Customer Counter"),
sidebarLayout(
sidebarPanel(
dataTableOutput("Game_Table"),
checkboxGroupInput(
inputId = "games",
label = "Games",
choices = fields,
inline = FALSE),
numericInput(
inputId = "num",
label = "Number of Customers",
min = 0,
max = 1000,
value = 0,
step = 1),
dateInput(
inputId = "date",
label = "Today's Date",
value = Sys.Date()),
checkboxGroupInput(
inputId = "semester",
label = "Semester",
choices = semesters,
inline = FALSE),
actionButton(
inputId = "submit",
label = "Submit")
),
mainPanel()
)
)
server <- function(input, output, session) {
formData <- reactive({
data <- sapply(Maindata, function(x) input[[x]])
data
})
observeEvent(input$submit, {
saveData(formData())
})
output$Game_Table <- renderDataTable({
input$submit
loadData()
})
}
table <- "Game_Table"
saveData <- function(data) {
# Grab the google sheet
table %>% gs_title("Sheet Key") %>% gs_add_row(input = data)
}
loadData <- function() {
table %>% gs_title("Sheet Key ") %>% gs_read_csv
}
shinyApp(ui = ui, server = server)
Basically, The output should just be an updating of the google sheet with what ever the person inputs as far as counts, date, what they did etc. I'm not sure what logical dataTableOutput()
is throwing.