title: “Project 08.29.2018” author: “Mikhail Groysman” date: “August 29, 2018” output: html_document

# Data: Poisonious Mushrooms

## Taken from: https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/

## Mushroom Database

## Sources: 
##    (a) Mushroom records drawn from The Audubon Society Field Guide to North
##        American Mushrooms (1981). G. H. Lincoff (Pres.), New York: Alfred
##        A. Knopf
##    (b) Donor: Jeff Schlimmer (Jeffrey.Schlimmer@a.gp.cs.cmu.edu)
##    (c) Date: 27 April 1987

# Data format

## classes: edible=e, poisonous=p)
## cap-shape:                bell=b,conical=c,convex=x,flat=f,
##                                  knobbed=k,sunken=s
## cap-surface:              fibrous=f,grooves=g,scaly=y,smooth=s
## cap-color:                brown=n,buff=b,cinnamon=c,gray=g,green=r,
##                                  pink=p,purple=u,red=e,white=w,yellow=y
## bruises?:                 bruises=t,no=f


#Part 1

## reading csv file from my desktop

MyData <- read.csv(file="c:/Users/Dell/Desktop/agaricus-lepiota.data.csv", header=FALSE, sep=",")

## Printing first 50 rows

head(MyData,n=50)

## Checking number of rows and columns

dim(MyData)

## getting summary of dataframe

summary(MyData)

## Assigning names to variables

names(MyData)<-c("Classes","Cap_Shape","Cap_Surface","Cap_Color","Bruises")

## Printing first 25 rows

head(MyData,n=25)

## Keeping first 5 columns

MyData1<-subset(MyData,select=c("Classes","Cap_Shape","Cap_Surface","Cap_Color","Bruises"))

## Printing first 10 rows

head(MyData1,n=10)

## Replacing values in dataframe

MyData1$Classes <- as.character(MyData1$Classes)

MyData1$Classes[MyData1$Classes == "e"] <- "Edible"

MyData1$Classes[MyData1$Classes == "p"] <- "Poisonious"

## Printing first 10 rows

head(MyData1,n=10)