Professional Documents
Culture Documents
Shiny: Cheat Sheet
Shiny: Cheat Sheet
render* - An output will automatically Reactive expression - use reactive to isolate - use use isolate to use an input observe - use observe to create code
4. Reactivity When an update whenever an input in its create objects that will be used in without depending on it. Shiny will not
rebuild the output when the isolated
that runs when an input changes, but
does not create an output object.
input changes, the server render* function changes. multiple outputs. input changes.
will rebuild each output that output$y input$a
depends on it (even if the input$a output$z input$a x output$z input$a observer
output$z
dependence is indirect). You input$b
R components - These are the output objects that • Widgets - The first argument of each widget function HTML elements - Add html elements with shiny
you defined in server.R. To place a component: is the <name> for the widget. You can access a functions that parallel common HTML tags.
widget’s current value in server.R with input$<name>
1. Select the *Output function that builds the type of object you a tags$col
tags$colgroup h1
tags$form tags$input
tags$ins
tags$output
p
tags$sub
tags$summary
tags$abbr
want to place in the UI. widget function common arguments tags$address tags$command h2 tags$kbd tags$param tags$sup
Action button actionButton inputId, label tags$data h3 tags$keygen pre tags$table
2. Pass the *Output function a character string that corresponds checkbox inputId, label, value
tags$area
tags$article tags$datalist h4 tags$label tags$progress tags$tbody
checkboxInput
to the name you assigned the object in server.R, e.g. checkbox group checkboxGroupInput inputId, label, choices, selected tags$aside tags$dd h5 tags$legend tags$q tags$td
tags$audio tags$del h6 tags$li tags$ruby tags$textarea
date selector dateInput inputId, label, value, min, max, format tags$b tags$details tags$head tags$link tags$rp tags$tfoot
output$plot <- renderPlot({ ... }) plotOutput("plot") date range selector dateRangeInput inputId, label, start, end, min, max, format tags$base tags$dfn tags$header tags$mark tags$rt tags$th
tags$bdi div tags$hgroup tags$map tags$s tags$thead
file uploader fileInput inputId, label, multiple tags$samp tags$time
tags$dl hr tags$menu
*Output functions Number field numericInput inputId, label, value, min, max, step
tags$bdo
tags$blockquote tags$dt HTML tags$meta tags$script tags$title
Radio buttons em tags$i tags$meter tags$section tags$tr
dataTableOutput tableOutput radioButtons inputId, label, choices, selected tags$body
tags$embed tags$iframe tags$nav tags$select tags$track
select box inputId, label, choices, selected, multiple br
htmlOutput textOutput selectInput
tags$button tags$eventsource img tags$noscript tags$small tags$u
slider sliderInput inputId, label, min, max, value, step tags$fieldset includeCSS tags$object tags$source tags$ul
imageOutput uiOutput submit button
tags$canvas
tags$figcaption includeMarkdo tags$ol span tags$var
submitButton text tags$caption
plotOutput verbatimTextOutput text field textInput inputId, label, value tags$cite tags$figure wn tags$optgroup strong tags$video
code tags$footer includeScript tags$option tags$style tags$wbr
6. Run your app 7. Share your app Launch your app as a live web page that users can visit online.