Example shinyApp

Coursera Johns Hopkins Data Projects

Rainer Englisch
coursera student

Overview

The course project of the Coursera Johns Hopkins Data Products course is about has one part of developing a shiny app and another part of creating a slidify presentation. This presentation gives an overview over the shiny app.

What does the shiny app

The shiny app basically uses the freely available mtcars data frame to compare observed mpg against the linear prediction of mpgs given a user chosen predictor variabel which is one of cylinders, transmission, gears, horse power or weight.

User Interface

The user interface basically allows the user to choose the predictor variable to be used for computing an univariable linear prediction model for predicting mpg.

alt screenshot of UI

Output tab Plot

The tab named Plot creates a scatter plot of mpg against the predictor variable and additionally plots a line connecting the predicted mpgs using a linear prediction model. plot of chunk unnamed-chunk-1

Output tab Summary

The tab Summary shows the summary of the current prediction model based on the user choosen predictor variable.

## 
## Call:
## lm(formula = .outcome ~ ., data = dat)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.9814 -2.1185  0.2217  1.0717  7.5186 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  37.8846     2.0738   18.27  < 2e-16 ***
## cyl          -2.8758     0.3224   -8.92 6.11e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.206 on 30 degrees of freedom
## Multiple R-squared:  0.7262, Adjusted R-squared:  0.7171 
## F-statistic: 79.56 on 1 and 30 DF,  p-value: 6.113e-10

Output tab Table

The last tab Table prints out the data frame mtcars itself.

##                    mpg cyl disp  hp drat    wt  qsec vs am gear carb
## Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
## Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
## Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
## Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
## Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
## Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1

Link to shiny app

This is the link to the shiny app hosted on shinyapp.io.