Asude Berber
09/09/2023
For more details on authoring R presentations please visit https://support.rstudio.com/hc/en-us/articles/200486468.
library(shiny)
# Define UI for application that draws a histogram
fluidPage(
# Application title
titlePanel("Asudes production-time distribution"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
<!–html_preserve–>
function(input, output, session) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
Distribution <- faithful[, 2]
bins <- seq(min(Distribution), max(Distribution), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(Distribution, breaks = bins, col = 'darkgray', border = 'white',
xlab = 'Waiting time to next eruption (in mins)',
main = 'Histogram of waiting times')
})
}