EVOLUTION-MANAGER
Edit File: varSelectInput.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Select variables from a data frame</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for varSelectInput {shiny}"><tr><td>varSelectInput {shiny}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Select variables from a data frame</h2> <h3>Description</h3> <p>Create a select list that can be used to choose a single or multiple items from the column names of a data frame. </p> <h3>Usage</h3> <pre> varSelectInput( inputId, label, data, selected = NULL, multiple = FALSE, selectize = TRUE, width = NULL, size = NULL ) varSelectizeInput(inputId, ..., options = NULL, width = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>inputId</code></td> <td> <p>The <code>input</code> slot that will be used to access the value.</p> </td></tr> <tr valign="top"><td><code>label</code></td> <td> <p>Display label for the control, or <code>NULL</code> for no label.</p> </td></tr> <tr valign="top"><td><code>data</code></td> <td> <p>A data frame. Used to retrieve the column names as choices for a <code><a href="selectInput.html">selectInput()</a></code></p> </td></tr> <tr valign="top"><td><code>selected</code></td> <td> <p>The initially selected value (or multiple values if <code>multiple = TRUE</code>). If not specified then defaults to the first value for single-select lists and no values for multiple select lists.</p> </td></tr> <tr valign="top"><td><code>multiple</code></td> <td> <p>Is selection of multiple items allowed?</p> </td></tr> <tr valign="top"><td><code>selectize</code></td> <td> <p>Whether to use <span class="pkg">selectize.js</span> or not.</p> </td></tr> <tr valign="top"><td><code>width</code></td> <td> <p>The width of the input, e.g. <code>'400px'</code>, or <code>'100%'</code>; see <code><a href="reexports.html">validateCssUnit()</a></code>.</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>Number of items to show in the selection box; a larger number will result in a taller box. Not compatible with <code>selectize=TRUE</code>. Normally, when <code>multiple=FALSE</code>, a select input will be a drop-down list, but when <code>size</code> is set, it will be a box instead.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Arguments passed to <code>varSelectInput()</code>.</p> </td></tr> <tr valign="top"><td><code>options</code></td> <td> <p>A list of options. See the documentation of <span class="pkg">selectize.js</span> for possible options (character option values inside <code><a href="../../base/html/AsIs.html">base::I()</a></code> will be treated as literal JavaScript code; see <code><a href="renderDataTable.html">renderDataTable()</a></code> for details).</p> </td></tr> </table> <h3>Details</h3> <p>By default, <code>varSelectInput()</code> and <code>selectizeInput()</code> use the JavaScript library <span class="pkg">selectize.js</span> (<a href="https://github.com/selectize/selectize.js">https://github.com/selectize/selectize.js</a>) to instead of the basic select input element. To use the standard HTML select input element, use <code>selectInput()</code> with <code>selectize=FALSE</code>. </p> <h3>Value</h3> <p>A variable select list control that can be added to a UI definition. </p> <h3>Server value</h3> <p>The resulting server <code>input</code> value will be returned as: </p> <ul> <li><p> A symbol if <code>multiple = FALSE</code>. The <code>input</code> value should be used with rlang's <code><a href="../../rlang/html/nse-force.html">rlang::!!()</a></code>. For example, <code>ggplot2::aes(!!input$variable)</code>. </p> </li> <li><p> A list of symbols if <code>multiple = TRUE</code>. The <code>input</code> value should be used with rlang's <code><a href="../../rlang/html/nse-force.html">rlang::!!!()</a></code> to expand the symbol list as individual arguments. For example, <code>dplyr::select(mtcars, !!!input$variabls)</code> which is equivalent to <code>dplyr::select(mtcars, !!input$variabls[[1]], !!input$variabls[[2]], ..., !!input$variabls[[length(input$variabls)]])</code>. </p> </li></ul> <h3>Note</h3> <p>The variable selectize input created from <code>varSelectizeInput()</code> allows deletion of the selected option even in a single select input, which will return an empty string as its value. This is the default behavior of <span class="pkg">selectize.js</span>. However, the selectize input created from <code>selectInput(..., selectize = TRUE)</code> will ignore the empty string value when it is a single choice input and the empty string is not in the <code>choices</code> argument. This is to keep compatibility with <code>selectInput(..., selectize = FALSE)</code>. </p> <h3>See Also</h3> <p><code><a href="updateSelectInput.html">updateSelectInput()</a></code> </p> <p>Other input elements: <code><a href="actionButton.html">actionButton</a>()</code>, <code><a href="checkboxGroupInput.html">checkboxGroupInput</a>()</code>, <code><a href="checkboxInput.html">checkboxInput</a>()</code>, <code><a href="dateInput.html">dateInput</a>()</code>, <code><a href="dateRangeInput.html">dateRangeInput</a>()</code>, <code><a href="fileInput.html">fileInput</a>()</code>, <code><a href="numericInput.html">numericInput</a>()</code>, <code><a href="passwordInput.html">passwordInput</a>()</code>, <code><a href="radioButtons.html">radioButtons</a>()</code>, <code><a href="selectInput.html">selectInput</a>()</code>, <code><a href="sliderInput.html">sliderInput</a>()</code>, <code><a href="submitButton.html">submitButton</a>()</code>, <code><a href="textAreaInput.html">textAreaInput</a>()</code>, <code><a href="textInput.html">textInput</a>()</code> </p> <h3>Examples</h3> <pre> ## Only run examples in interactive R sessions if (interactive()) { library(ggplot2) # single selection shinyApp( ui = fluidPage( varSelectInput("variable", "Variable:", mtcars), plotOutput("data") ), server = function(input, output) { output$data <- renderPlot({ ggplot(mtcars, aes(!!input$variable)) + geom_histogram() }) } ) # multiple selections ## Not run: shinyApp( ui = fluidPage( varSelectInput("variables", "Variable:", mtcars, multiple = TRUE), tableOutput("data") ), server = function(input, output) { output$data <- renderTable({ if (length(input$variables) == 0) return(mtcars) mtcars %>% dplyr::select(!!!input$variables) }, rownames = TRUE) } ) ## End(Not run) } </pre> <hr /><div style="text-align: center;">[Package <em>shiny</em> version 1.5.0 <a href="00Index.html">Index</a>]</div> </body></html>