27/08/2020

Introduction

  • This shiny app was built to allow users to predict the petal length based on the sepal length
  • It uses the iris dataset
  • It has a few user inputs
  • The data and model are shown in a plot
  • The output is displayed as text

The data

  • The data is sourced from Edgar Anderson’s iris dataset (built into R)
  • It includes the following features:
  • Sepal Length
  • Sepal Width
  • Petal Length
  • Petal Width
  • Species

How the app works

  • The user inputs the value of sepal length used in by the model
  • The user has the option to display/hide the regression model
  • The user clicks submit to execute the prediction calculation
  • The predicted value is displayed under the plot
  • The data points are coloured based on the species type

Example plot

model1 <- lm(Petal.Length ~ Sepal.Length, data = iris)
plot(iris$Sepal.Length, iris$Petal.Length, xlab = "Sepal length", 
     ylab = "Petal length", bty = "n", pch = 16, col = iris$Species)
abline(model1, col = "red", lwd = 2)
legend(7,4.3,unique(iris$Species),col=1:length(iris$Species),pch=16)