BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
Explore a dataset with Shiny
Dean Aali
Shiny Consultant
Explore a dataset with Shiny Dean A ali Shiny Consultant Building - - PowerPoint PPT Presentation
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES Explore a dataset with Shiny Dean A ali Shiny Consultant Building Web Applications in R with Shiny: Case Studies Explore a dataset with Shiny Dataset + Interactive environment +
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
Shiny Consultant
Building Web Applications in R with Shiny: Case Studies
Building Web Applications in R with Shiny: Case Studies
country continent year lifeExp pop gdpPercap Afghanistan Asia 1952 28.801 8425333 779.4453145 Afghanistan Asia 1957 30.332 9240934 820.8530296 Afghanistan Asia 1962 31.997 10267083 853.10071 Afghanistan Asia 1967 34.02 11537966 836.1971382 Afghanistan Asia 1972 36.088 13079460 739.9811058 Afghanistan Asia 1977 38.438 14880372 786.11336 Afghanistan Asia 1982 39.854 12881816 978.0114388 Afghanistan Asia 1987 40.822 13867957 852.3959448 Afghanistan Asia 1992 41.674 16317921 649.3413952 Afghanistan Asia 1997 41.763 22227415 635.341351
Building Web Applications in R with Shiny: Case Studies
tableOutput("my_table")
gapminder })
Building Web Applications in R with Shiny: Case Studies
selectInput("country", "Country", choices = levels(gapminder$country))
subset(gapminder, country == input$country) })
Building Web Applications in R with Shiny: Case Studies
selectInput("country", "Country", choices = levels(gapminder$country)[1:10])
selectInput("country", "Country", choices = c("any", levels(gapminder$country)))
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
Shiny Consultant
Building Web Applications in R with Shiny: Case Studies
plotOutput("my_plot")
# code for a plot })
Building Web Applications in R with Shiny: Case Studies
Building Web Applications in R with Shiny: Case Studies
country,continent,year,lifeExp,pop,gdpPercap Afghanistan,Asia,1952,28.801,8425333,779.4453145 Afghanistan,Asia,1957,30.332,9240934,820.8530296 Afghanistan,Asia,1962,31.997,10267083,853.10071 Afghanistan,Asia,1967,34.02,11537966,836.1971382
write.csv(gapminder, "myfile.csv")
Building Web Applications in R with Shiny: Case Studies
downloadButton(outputId = “download_data”, label = “Download data”)
filename = "data.csv", content = function(file) { # Code that creates a file in the path <file> write.csv(gapminder, file) } )
Building Web Applications in R with Shiny: Case Studies
filename = “data.csv”, content = function(file) { # code that creates a file in the path <file> write.csv(gapminder, file) } )
`
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
Shiny Consultant
Building Web Applications in R with Shiny: Case Studies
data <- gapminder data <- subset( data, lifeExp >= input$life[1] & lifeExp <= input$life[2] ) if (input$continent != "All") { data <- subset( data, continent == input$continent ) }
Building Web Applications in R with Shiny: Case Studies
Building Web Applications in R with Shiny: Case Studies
data <- gapminder data <- subset( data, lifeExp >= input$life[1] & lifeExp <= input$life[2] ) }) my_data <- reactive({ })
my_data() }) data <- gapminder data <- subset( data, lifeExp >= input$life[1] & lifeExp <= input$life[2] )
Building Web Applications in R with Shiny: Case Studies
Building Web Applications in R with Shiny: Case Studies
fit_model(input$num) })
ggplot( fit_model(input$num), ...) })
x <- reactive({ fit_model(input$num) })
x() })
ggplot(x(), ...) })
Building Web Applications in R with Shiny: Case Studies
x <- reactive({ fit_model(input$num) })
filename = "x.csv", content = function(file) { write.csv(x(), file) } )
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES
Shiny Consultant
Building Web Applications in R with Shiny: Case Studies
tableOutput("table")
Building Web Applications in R with Shiny: Case Studies
DT::dataTableOutput("table")
Building Web Applications in R with Shiny: Case Studies
Building Web Applications in R with Shiny: Case Studies
tabPanel(title = "tab 1", "content goes here") tabPanel(title = "tab 2", "second tab", plotOutput("plot")) fluidPage( tabPanel(title = "tab 1", "first tab content goes here"), tabPanel(title = "tab 2", "second tab", plotOutput("plot")), tabPanel(title = "tab 3", textInput("text", "Name", "")) ) fluidPage( tabsetPanel( tabPanel(title = "tab 1", "first tab content goes here"), tabPanel(title = "tab 2", "second tab", plotOutput("plot")), tabPanel(title = "tab 3", textInput("text", "Name", "")) ) )
Building Web Applications in R with Shiny: Case Studies
Building Web Applications in R with Shiny: Case Studies
#ID { property: value; property: value; ... }
ui <- fluidPage( tags$style(" #ID { property: value; } ") )
Building Web Applications in R with Shiny: Case Studies
ui <- fluidPage( textInput("name", "Enter your name", "Dean"), tableOutput("table") )
Building Web Applications in R with Shiny: Case Studies
css <- " " ui <- fluidPage( textInput("name", "Enter your name", "Dean"), tableOutput("table") ) #table { background: yellow; font-size: 24px; } #name { color: red; } tags$style(css),
BUILDING WEB APPLICATIONS IN R WITH SHINY: CASE STUDIES