Histogram

Ravi Teja
30-10-2020

Introduction

The aim of this presentation is

  • It must be done in Slidify or Rstudio Presenter
  • It must be 5 pages
  • It must be hosted on github or Rpubs
  • It must contained some embedded R code that gets run when slidifying the document

How this is done

  • A Shiny app is created in RStudio
  • ui.R is created
  • server.R is created

Function

  • This function takes input from the user between 1 and 50.
  • By default, the slider is set at 30
  • After the processing the corresponding histogram is shown.

Server Function

output$distPlot <- renderPlot({

        # generate bins based on input$bins from ui.R
        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')

    })