library(shiny)
## Warning: package 'shiny' was built under R version 3.2.5
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.5
library(plotly)
## Warning: package 'plotly' was built under R version 3.2.5
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:graphics':
##
## layout
This is a shiny presentation using “mtcars database. There are three tab panels: the first one creates a histogram from a chosen variable; the second one combines two variables producing a two dimension graphic; the third one provides a statistical summary.
To create an histogram I’ve used ggplot and plotly. The user can choose any variable from database. Let’s see an example with the plotly library
a<-qplot(mpg, data=mtcars)
a
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
In this tab panel the user can choose two variables from mtcars dataset. Automatically, there is a scatterplot of these two variables.
plot(mtcars$mpg, mtcars$disp)
In this tab panel the user can select from a checkbox the variables he/she wants to incorporate to the summary.
summary(mtcars$mpg)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 10.40 15.42 19.20 20.09 22.80 33.90
The advantage of shiny application is its interactivity, and the user easily can choose different graphics and variables.