Veronica Vaca
10/09/2018
Build a Shiny App for the course Project
For this app I took as a reference this link in Rpubs https://rpubs.com/mohitagr18/239997, and I converted it in a reactive shiny app
We use the iris data set. The Petal's length and width and the Sepal's length and width to predict the class Species.
We can chose between 5 metodologies to compare the predictions
Pushing the Compute button will make the results to appear.
For running the app and these presentation without errors you have to install the following packages:
We are going to see some statistics of the data set and then split it into the training and testing set.
require(caret); require(plotly);require(shiny)
summary(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width
Min. :4.300 Min. :2.000 Min. :1.000 Min. :0.100
1st Qu.:5.100 1st Qu.:2.800 1st Qu.:1.600 1st Qu.:0.300
Median :5.800 Median :3.000 Median :4.350 Median :1.300
Mean :5.843 Mean :3.057 Mean :3.758 Mean :1.199
3rd Qu.:6.400 3rd Qu.:3.300 3rd Qu.:5.100 3rd Qu.:1.800
Max. :7.900 Max. :4.400 Max. :6.900 Max. :2.500
Species
setosa :50
versicolor:50
virginica :50
sample <- createDataPartition(iris$Species, p=0.80, list=FALSE)
iris_train <- iris[sample,]
Now that we have the training set we can make some plots of it, in the shiny app you can chose between a boxplot and a barplot, here we are going to see the boxplots. I couldn't put a plotly plot in the presentation but in the app the boxplots are made in Plotly.
For th multivariate plots in the shiny app you have 3 choices, scatter, box and density plots from the caret package.
You have to see this working on the following link. https://vero.shinyapps.io/appweek4/
And the code you can find in: https://github.com/vefra/DevelopingDataProductsProject
Here we have an example.
Finally we make the comparisson between the models.