Automatically genrates slider inputs for all numeric variables in a dataframe.

autoinput_numerical(.df, .dec_places = 0)

Arguments

.df

Dataframe with N variables (one or more should be numeric)

Value

SliderInputs for all the numeric variables.

Details

Based on the numeric columns on a dataframe, this function generates all the slider inputs. The min/max value on the dataframe is the min/max value on the slider.

Examples

## Only run this example in interactive R sessions
if (interactive()) {
library(shiny)
library(shinymatic)
load('data/customers.rda')
ui <- fluidPage(
  h3('UI (inputs)'),
  autoinput_numerical(.df = customers),
  h3('Server (output)'),
  verbatimTextOutput(outputId = 'values')
)
server <- function(input, output) {
  output$values <- reactive({
    vars_num <- names(customers)[sapply(customers, is.numeric)]
    paste0(sapply(
      vars_num,
      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