R Workshops
Fall 2014
The quickest/easiest way to create a shiny app is to define the user interface in a file named ui.R and the server side functionality in server.R.
library(shiny)
# A simple/common user interface template
shinyUI(fluidPage(
# Application title
titlePanel("Title"),
sidebarPanel(
# Define some inputs here
),
mainPanel(
# output (from the server) go here
)
))
library(shiny)
# Server side logic
shinyServer(function(input, output) {
# do something
})
shiny is built on the idea of reactive programming. The idea that outputs should be automatically updated whenever an input value changes.
input values => R code => output values
Reactive expressions keep track of what values they read and what values they change. If those values become “out of date”, they know their return value is out of date and will automatically recalculate.
shiny::runApp("shinyApps/02_Reactivity", display.mode = "showcase")
shiny::runApp("shinyApps/01_Hello", display.mode = "showcase")
?numericInput).rgamma).conditionalPanel).library(shiny)
runGitHub('shiny_apps', 'cpsievert',
subdir = 'extend1',
display.mode = "showcase")
runGitHub('shiny_apps', 'cpsievert',
subdir = 'extend2',
display.mode = "showcase")
runGitHub('shiny_apps', 'cpsievert',
subdir = 'extend3',
display.mode = "showcase")