Automatically genrates inputs for all variables in a dataframe.

autoinputs(.df)

Arguments

.df

Dataframe with N variables (date, factor or numeric types are supported)

Value

Input buttons for all variables.

Details

Based on the columns on a dataframe, this function generates all the inputs.

Examples

## Only run this example in interactive R sessions
if (interactive()) {
library(shiny)
library(shinymatic)
load('data/customers.rda')
ui <- fluidPage(fluidRow(
  column(3,
         h3('Inputs based on df'),
         autoinputs(.df=customers)
  ),
  column(3,
         h3('Outputs based on inputs'),
         verbatimTextOutput(outputId = 'values')
  )
))
server <- function(input, output) {
  output$values <- reactive({
    paste0(sapply(
      names(customers),
      FUN = function(i) paste(i, "=", input[[i]])),
      collapse = '\n')
  })
}
shinyApp(ui = ui, server = server)
}
#> Warning: cannot open compressed file 'data/customers.rda', probable reason 'No such file or directory'
#> Error in readChar(con, 5L, useBytes = TRUE): cannot open the connection