October 9, 2018

Introduction:

The Iris dataset in R gives the measurements of sepals and petals of 3 Iris flower species. Using the petal measurements alone shows the 3 destinctive species, and can be used alone to predict it.

##   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1          5.1         3.5          1.4         0.2  setosa
## 2          4.9         3.0          1.4         0.2  setosa
## 3          4.7         3.2          1.3         0.2  setosa
## 4          4.6         3.1          1.5         0.2  setosa
## 5          5.0         3.6          1.4         0.2  setosa
## 6          5.4         3.9          1.7         0.4  setosa

Visualization:

plot(iris$Petal.Length, iris$Petal.Width, pch=21, 
         bg=c("red","yellow","blue")[unclass(iris$Species)], 
         main="Edgar Anderson's Iris Data", xlab = 
         "Petal Length", ylab = "Petal Length")

Purpose of the App:

In this flower identification app, you can enter the petal measurements of your Iris flower, and pick your guess about what species this may be.

The App will plot the measurements for you, it will fit a prediction model to the data, and will tell you if your guess was right.

Code used:

Sp <- input$text
Len <- input$numeric1
Wd <- input$numeric2
library(caret)
fit <- train(Species ~ Petal.Length + Petal.Width, data = iris, 
                 method = "rpart")
X <- data.frame("Petal.Length" = Len, "Petal.Width" = Wd, "Species" = Sp)
pred <- predict(fit, newdata = X)
ifelse(pred == Sp, "You are the best!!", "Yikes, try again")