This is the introduction.
Load mushroom data.
mushrooms <- read.csv("https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/agaricus-lepiota.data",header = FALSE, sep = ",")
Prepare the data.
mushrooms <- subset(mushrooms, select = c(V1, V4, V6, V23))
colnames(mushrooms) <- c("Class", "CapColor", "Odor", "Habitat")
levels(mushrooms$Class) <- c("edible", "poisonous")
levels(mushrooms$CapColor) <- c("buff", "cinnamon", "red", "gray", "brown", "pink",
"green", "purple", "white", "yellow")
levels(mushrooms$Odor) <- c("almond", "creosote", "foul", "anise", "musty", "none",
"pungent", "spicy", "fishy")
levels(mushrooms$Habitat) <- c("woods", "grasses", "leaves", "meadows", "paths", "urban",
"waste")
Report the data.
head(mushrooms)
## Class CapColor Odor Habitat
## 1 poisonous brown pungent urban
## 2 edible yellow almond grasses
## 3 edible white anise meadows
## 4 poisonous white pungent urban
## 5 edible gray none grasses
## 6 edible yellow almond grasses