R Markdown
mushroomData <- read.table("https://raw.githubusercontent.com/sadia-perveen/R-Assignments/master/agaricus-lepiota.data", sep =",", header = FALSE)
summary(mushroomData)
## V1 V2 V3 V4 V5 V6
## e:4208 b: 452 f:2320 n :2284 f:4748 n :3528
## p:3916 c: 4 g: 4 g :1840 t:3376 f :2160
## f:3152 s:2556 e :1500 s : 576
## k: 828 y:3244 y :1072 y : 576
## s: 32 w :1040 a : 400
## x:3656 b : 168 l : 400
## (Other): 220 (Other): 484
## V7 V8 V9 V10 V11 V12 V13
## a: 210 c:6812 b:5612 b :1728 e:3516 ?:2480 f: 552
## f:7914 w:1312 n:2512 p :1492 t:4608 b:3776 k:2372
## w :1202 c: 556 s:5176
## n :1048 e:1120 y: 24
## g : 752 r: 192
## h : 732
## (Other):1170
## V14 V15 V16 V17 V18 V19
## f: 600 w :4464 w :4384 p:8124 n: 96 n: 36
## k:2304 p :1872 p :1872 o: 96 o:7488
## s:4936 g : 576 g : 576 w:7924 t: 600
## y: 284 n : 448 n : 512 y: 8
## b : 432 b : 432
## o : 192 o : 192
## (Other): 140 (Other): 156
## V20 V21 V22 V23
## e:2776 w :2388 a: 384 d:3148
## f: 48 n :1968 c: 340 g:2148
## l:1296 k :1872 n: 400 l: 832
## n: 36 h :1632 s:1248 m: 292
## p:3968 r : 72 v:4040 p:1144
## b : 48 y:1712 u: 368
## (Other): 144 w: 192
mushroomData$V1 <- as.character(mushroomData$V1)
mushroomData$V2 <- as.character(mushroomData$V2)
mushroomData$V3 <- as.character(mushroomData$V3)
mushroomData$V4 <- as.character(mushroomData$V4)
mushroomData$V1[mushroomData$V1 =="p"] <- "poisonous"
mushroomData$V1[mushroomData$V1 =="e"] <- "edible"
mushroomData$V2[mushroomData$V2 =="b"] <- "bell"
mushroomData$V2[mushroomData$V2 =="c"] <- "conical"
mushroomData$V2[mushroomData$V2 =="x"] <- "convex"
mushroomData$V2[mushroomData$V2 =="f"] <- "flat"
mushroomData$V2[mushroomData$V2 =="k"] <- "knobbed"
mushroomData$V2[mushroomData$V2 =="s"] <- "sunken"
mushroomData$V3[mushroomData$V3 =="f"] <- "fibrous"
mushroomData$V3[mushroomData$V3 =="g"] <- "grooves"
mushroomData$V3[mushroomData$V3 =="y"] <- "scaly"
mushroomData$V3[mushroomData$V3 =="s"] <- "smooth"
mushroomData$V4[mushroomData$V4 =="n"] <- "brown"
mushroomData$V4[mushroomData$V4 =="b"] <- "buff"
mushroomData$V4[mushroomData$V4 =="c"] <- "cinnamon"
mushroomData$V4[mushroomData$V4 =="g"] <- "gray"
mushroomData$V4[mushroomData$V4 =="r"] <- "green"
mushroomData$V4[mushroomData$V4 =="p"] <- "pink"
mushroomData$V4[mushroomData$V4 =="u"] <- "purple"
mushroomData$V4[mushroomData$V4 =="e"] <- "red"
mushroomData$V4[mushroomData$V4 =="w"] <- "white"
mushroomData$V4[mushroomData$V4 =="y"] <- "yellow"
final_data <- data.frame(mushroomData$V1, mushroomData$V2, mushroomData$V3, mushroomData$V4)
names(final_data) <- c("mushroomEdible", "CapShape", "CapSurface", "CapColor")
plot(final_data$mushroomEdible)

plot(final_data$CapColor)

summary(final_data)
## mushroomEdible CapShape CapSurface CapColor
## edible :4208 bell : 452 fibrous:2320 brown :2284
## poisonous:3916 conical: 4 grooves: 4 gray :1840
## convex :3656 scaly :3244 red :1500
## flat :3152 smooth :2556 yellow :1072
## knobbed: 828 white :1040
## sunken : 32 buff : 168
## (Other): 220
head(final_data, 20)
## mushroomEdible CapShape CapSurface CapColor
## 1 poisonous convex smooth brown
## 2 edible convex smooth yellow
## 3 edible bell smooth white
## 4 poisonous convex scaly white
## 5 edible convex smooth gray
## 6 edible convex scaly yellow
## 7 edible bell smooth white
## 8 edible bell scaly white
## 9 poisonous convex scaly white
## 10 edible bell smooth yellow
## 11 edible convex scaly yellow
## 12 edible convex scaly yellow
## 13 edible bell smooth yellow
## 14 poisonous convex scaly white
## 15 edible convex fibrous brown
## 16 edible sunken fibrous gray
## 17 edible flat fibrous white
## 18 poisonous convex smooth brown
## 19 poisonous convex scaly white
## 20 poisonous convex smooth brown