1. Shiny Presentation

This R Markdown presentation is made interactive using Shiny. The viewers of the presentation can change the assumptions underlying what’s presented and see the results immediately.

To learn more, see Interactive Documents.

2. Assignment

OK, you’ve made your shiny app, now it’s time to make your pitch. You get 5 slides (inclusive of the title slide) to pitch a your app. You’re going to create a web page using Slidify or Rstudio Presenter with an html5 slide deck.

Here’s what you need

3. Project Objective

Your presentation must satisfy the following

NOTE: Slidify is no longer compatible with with Rpubs. If you choose to use Slidify you must share your presentation using GitHub Pages.

4. Configuration

the following necessary packages must be installed for the Shiny () library to work:

##install.packages("ggplot2")
##install.packages("graphics")
##install.packages("plotly")
##install.packages("shiny")
##install.packages("shinythemes")
##install.packages("dplyr")

Once the packages are installed, the following libraries must be run:

library(ggplot2), library(graphics)
library(plotly), library(shiny)
library(shinythemes), library(dplyr)

5. Load and display the data

Load and display the data

vehi1 <- read.csv("C:/Users/FGO/Desktop/Especializacion Data Science/9.Developing Data Products/TRABAJO4/vehi1.csv", sep=";")
head(vehi1)
vehi1 <- read.csv("C:/Users/FGO/Desktop/Especializacion Data Science/9.Developing Data Products/TRABAJO4/vehi1.csv", sep=";")
    head(vehi1)
##   id recorrido vehiculo
## 1  1     3.600       79
## 2  2     1.800       54
## 3  3     3.333       74
## 4  4     2.283       62
## 5  5     4.533       85
## 6  6     2.883       55

6. Iteractive application in RStudio using the shiny () function

7. Code R Server.R

library(shiny)
shinyServer(function(input, output) {

output$distPlot <- renderPlot({
    
    # generate bins based on input$bins from ui.R
    nro_vehiculo    <- vehi1[, 3]
    bins <- seq(min(nro_vehiculo), max(nro_vehiculo), length.out = input$bins + 1)
    
    # draw the histogram with the specified number of bins
    hist(nro_vehiculo, breaks = bins, border="white", col="darkorange")
    
})

})

8. Code R ui.R

shinyUI(fluidPage(
titlePanel("Number of Kilometers Traveled x Vehicle Number"),
sidebarLayout(
    sidebarPanel(
        sliderInput("bins",
                    "Number of bins:",
                    min = 1,
                    max = 50,
                    value = 30)
    ),
    mainPanel(
        plotOutput("distPlot")
    )
)
))