EVOLUTION-MANAGER
Edit File: radioButtons.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: Create radio buttons</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 radioButtons {shiny}"><tr><td>radioButtons {shiny}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Create radio buttons</h2> <h3>Description</h3> <p>Create a set of radio buttons used to select an item from a list. </p> <h3>Usage</h3> <pre> radioButtons( inputId, label, choices = NULL, selected = NULL, inline = FALSE, width = NULL, choiceNames = NULL, choiceValues = 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>choices</code></td> <td> <p>List of values to select from (if elements of the list are named then that name rather than the value is displayed to the user). If this argument is provided, then <code>choiceNames</code> and <code>choiceValues</code> must not be provided, and vice-versa. The values should be strings; other types (such as logicals and numbers) will be coerced to strings.</p> </td></tr> <tr valign="top"><td><code>selected</code></td> <td> <p>The initially selected value (if not specified then defaults to the first value)</p> </td></tr> <tr valign="top"><td><code>inline</code></td> <td> <p>If <code>TRUE</code>, render the choices inline (i.e. horizontally)</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>choiceNames, choiceValues</code></td> <td> <p>List of names and values, respectively, that are displayed to the user in the app and correspond to the each choice (for this reason, <code>choiceNames</code> and <code>choiceValues</code> must have the same length). If either of these arguments is provided, then the other <em>must</em> be provided and <code>choices</code> <em>must not</em> be provided. The advantage of using both of these over a named list for <code>choices</code> is that <code>choiceNames</code> allows any type of UI object to be passed through (tag objects, icons, HTML code, ...), instead of just simple text. See Examples.</p> </td></tr> </table> <h3>Details</h3> <p>If you need to represent a "None selected" state, it's possible to default the radio buttons to have no options selected by using <code>selected = character(0)</code>. However, this is not recommended, as it gives the user no way to return to that state once they've made a selection. Instead, consider having the first of your choices be <code>c("None selected" = "")</code>. </p> <h3>Value</h3> <p>A set of radio buttons that can be added to a UI definition. </p> <h3>Server value</h3> <p>A character string containing the value of the selected button. </p> <h3>See Also</h3> <p><code><a href="updateRadioButtons.html">updateRadioButtons()</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="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>, <code><a href="varSelectInput.html">varSelectInput</a>()</code> </p> <h3>Examples</h3> <pre> ## Only run examples in interactive R sessions if (interactive()) { ui <- fluidPage( radioButtons("dist", "Distribution type:", c("Normal" = "norm", "Uniform" = "unif", "Log-normal" = "lnorm", "Exponential" = "exp")), plotOutput("distPlot") ) server <- function(input, output) { output$distPlot <- renderPlot({ dist <- switch(input$dist, norm = rnorm, unif = runif, lnorm = rlnorm, exp = rexp, rnorm) hist(dist(500)) }) } shinyApp(ui, server) ui <- fluidPage( radioButtons("rb", "Choose one:", choiceNames = list( icon("calendar"), HTML("<p style='color:red;'>Red Text</p>"), "Normal text" ), choiceValues = list( "icon", "html", "text" )), textOutput("txt") ) server <- function(input, output) { output$txt <- renderText({ paste("You chose", input$rb) }) } shinyApp(ui, server) } </pre> <hr /><div style="text-align: center;">[Package <em>shiny</em> version 1.5.0 <a href="00Index.html">Index</a>]</div> </body></html>