For this assignment, I used the following code to create a clearly defined data frame.
library(RCurl)
## Loading required package: bitops
x <- getURL("https://raw.githubusercontent.com/mfarris9505/DataMushroom/master/MushroomData%20-%20Sheet1%20(1).csv")
Mushroom<- read.csv(text =x)
headers <- c("Class", "CapShape","CapSurface", "CapColor","Bruises","Odor","GillAttachment", "GillSpacing","GillSize", "GillColor")
names(Mushroom) <-headers
Mushroom$Class <- as.character(Mushroom$Class)
Mushroom$Class [Mushroom$Class == "p"] <- "Poisonous"
Mushroom$Class [Mushroom$Class == "e"] <- "Edible"
Mushroom$Class <- as.factor(Mushroom$Class)
Mushroom$CapShape <- as.character(Mushroom$CapShape)
Mushroom$CapShape [Mushroom$CapShape == "b"] <- "Bell"
Mushroom$CapShape [Mushroom$CapShape == "c"] <- "Conical"
Mushroom$CapShape [Mushroom$CapShape == "x"] <- "Conical"
Mushroom$CapShape [Mushroom$CapShape == "f"] <- "Conical"
Mushroom$CapShape [Mushroom$CapShape == "k"] <- "Conical"
Mushroom$CapShape [Mushroom$CapShape == "s"] <- "sunken"
Mushroom$CapShape <- as.factor(Mushroom$CapShape)
Mushroom$CapSurface <- as.character(Mushroom$CapSurface)
Mushroom$CapSurface [Mushroom$CapSurface == "f"] <- "Fibrous"
Mushroom$CapSurface [Mushroom$CapSurface == "g"] <- "Grooves"
Mushroom$CapSurface [Mushroom$CapSurface == "y"] <- "Scaly"
Mushroom$CapSurface [Mushroom$CapSurface == "s"] <- "Smooth"
Mushroom$CapSurface <- as.factor(Mushroom$CapSurface)
Mushroom$CapColor <- as.character(Mushroom$CapColor)
Mushroom$CapColor [Mushroom$CapColor == "n"] <- "Brown"
Mushroom$CapColor [Mushroom$CapColor == "b"] <- "Buff"
Mushroom$CapColor [Mushroom$CapColor == "c"] <- "Cinnamon"
Mushroom$CapColor [Mushroom$CapColor == "g"] <- "Gray"
Mushroom$CapColor [Mushroom$CapColor == "r"] <- "Green"
Mushroom$CapColor [Mushroom$CapColor == "p"] <- "Pink"
Mushroom$CapColor [Mushroom$CapColor == "u"] <- "Purple"
Mushroom$CapColor [Mushroom$CapColor == "e"] <- "Red"
Mushroom$CapColor [Mushroom$CapColor == "w"] <- "White"
Mushroom$CapColor [Mushroom$CapColor == "y"] <- "Yellow"
Mushroom$CapColor <- as.factor(Mushroom$CapColor)
Mushroom$Bruises <- as.character(Mushroom$Bruises)
Mushroom$Bruises [Mushroom$Bruises == "t"] <- "Bruises"
Mushroom$Bruises [Mushroom$Bruises == "f"] <- "None"
Mushroom$Bruises <- as.factor(Mushroom$Bruises)
summary(Mushroom)
## Class CapShape CapSurface CapColor Bruises Odor
## Edible :78 Bell :24 Fibrous:17 Brown :21 Bruises:76 a:26
## Poisonous:15 Conical:65 Scaly :44 Gray : 8 None :17 l:35
## sunken : 4 Smooth :32 White :28 n:17
## Yellow:36 p:15
##
## GillAttachment GillSpacing GillSize GillColor
## f:93 c:78 b:62 g:11
## w:15 n:31 k:25
## n:28
## p:10
## w:19