Abdulla Zhaina
November 16, 2026
A Shiny app that identifies iris species from four flower measurements
Identifying an iris species usually means comparing measurements against reference tables by hand.
server.R fits a Linear Discriminant Analysis model on the iris data (150 flowers, 4 measurements) and predicts the user's input:
library(MASS)
fit <- lda(Species ~ ., data = iris)
flower <- data.frame(Sepal.Length = 5.8, Sepal.Width = 3.0,
Petal.Length = 4.3, Petal.Width = 1.3)
round(predict(fit, flower)$posterior * 100, 1)
setosa versicolor virginica
1 0 100 0
The model classifies 98% of the training flowers correctly.
The Explore tab plots any two measurements; your flower appears as a black star:
No R knowledge needed: open the link, move the sliders, and read the prediction. The Documentation & Help tab explains the rest.