# # This is a Shiny web application. You can run the application by clicking # the 'Run App' button above. # # Find out more about building applications with Shiny here: # # http://shiny.rstudio.com/ # ## This app puts the slider and the output in a set of layout functions. These ## can be quite elaborate but will permit more sophisticated interfaces. ## Instructions: ## * Move the changes you made for app1 into these sidebarLayout functions. ## * In the sidebar, add a link to an image--the MTU logo at https://upload.wikimedia.org/wikipedia/en/c/c9/Michigan_Technological_University_logo.svg ## * In the sidebar, add formatting for an html link to http://mtu.edu ## * in the sidebar, add other formatted text, headers, links ## * Add a locally stored (server-side) image, by putting it in the www\ folder and referring to it. library(shiny) library(ggplot2) library(ggExtra) vals <- rnorm(5000) # Define UI for application that draws a histogram ui <- fluidPage( # Application title titlePanel("Random distribution generation"), # 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") ) ) ) # Define server logic required to draw a histogram server <- function(input, output) { output$distPlot <- renderPlot({ x <- runif(1000) # draw the histogram with the specified number of bins a <- as.data.frame(x) |> ggplot(aes(x=x)) +geom_histogram(bins=input$bins,fill="orange2",color="black") + theme_bw() b <- as.data.frame(x) |> ggplot(aes(sample=x)) + geom_qq() + theme_bw() grid.arrange(a,b,ncol=2) }) } # Run the application shinyApp(ui = ui, server = server)