Skip to content

Instantly share code, notes, and snippets.

View server.R
shinyServer(function(input, output, session) {
tmpData <- reactive({
modFlights %>%
filter(name %in% input$carrierName)
})
output$delayRange <- renderUI({
max_delay <- max(tmpData()$dep_delay)
View server.R
shinyServer(function(input, output, session) {
output$delayRange <- renderUI({
max_delay <- max(modFlights$dep_delay)
sliderInput('delayFlightRange',
label = "Choose delay range (minutes):",
min = 0, max = max_delay,
value = c(0, max_delay), step = 10)
View server.R
shinyServer(function(input, output, session) {
dayFilteredData <- reactive({
modFlights %>%
filter(name %in% input$carrierName) %>%
group_by(name, hour) %>%
summarise(delayed_flight_perc = sum(dep_delay > input$delayFlightRange[1] &
dep_delay < input$delayFlightRange[2] &
distance > input$distance_val) /
sum(distance > input$distance_val))
View server.R
shinyServer(function(input, output, session) {
output$ddelay_plot <- renderPlot({
aggDelayFlights <- modFlights %>%
filter(name %in% input$carrierName) %>%
group_by(name, hour) %>%
summarise(delayed_flight_perc = sum(dep_delay > input$delayFlightRange[1] &
dep_delay < input$delayFlightRange[2] &
distance > input$distance_val) /
View global.R
library(dplyr)
library(shiny)
library(nycflights13)
library(ggplot2)
library(ggthemes)
options(scipen = 999)
flights <- flights
View ui.R
fluidPage(
titlePanel(title = "Introduction to Shiny"),
sidebarPanel(
selectInput("carrierName",
label = "Select carrier:",
choices = sort(chosenCarrier$name),
selected = sort(chosenCarrier$name)[1],
multiple = T),
sliderInput('delayFlightRange',
View ui.R
fluidPage(
titlePanel(title = "Introduction to Shiny"),
sidebarPanel(
selectInput("carrierName",
label = "Select carrier:",
choices = sort(chosenCarrier$name),
selected = sort(chosenCarrier$name)[1],
multiple = T),
sliderInput('delayFlightRange',
View server.R
library(shiny)
options(shiny.autoreload = TRUE)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
View dynamic-dropdownMenu.R
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Dropdowns 2.0",
dropdownMenuOutput("menu")
),
dashboardSidebar(
sidebarMenu(
menuItem("Tab1", tabName = "tab_1"),
You can’t perform that action at this time.