ds1 <- read.csv("/Users/anirudhgurnani/Desktop/heart.csv", stringsAsFactors = FALSE)
##1. Create Univariate analysis for the variable of your interest (your Y variable).
##Calculate skewness and kurtosis and describe the results. [histogram, skewness values, kurtosis values, description - 10pts]
heart <- ds1$age
hist(heart)

library(moments)
skewness(ds1$age)
## [1] -0.2485016
kurtosis(ds1$age)
## [1] 2.471095
##2.Create Bivariate plot Box Plot for your Y variable and one of other important metrics (your X).
##Describe figure. [box plot, description]
#0=('Typical Angina')
#1=('Atypical Angina')
#2=('Non-Anginal')
#3=('Asymptomatic')
boxplot(age~cp,data=ds1, main="Chest Pain Type",
xlab="Pain Types", ylab="Age of Patient")

## WE Can conclude 0=Typical Agina Chest Pain Type is the most common Chest Pain Type .
#3.If your variables are continuous - Create a scatter plot between your Y and your X.
#If your variables are categorical - Create a bar plot. Describe figure [plot, description ]
pairs(~age+trestbps+chol+thalach,data=ds1,
main="Simple Scatterplot Matrix")

## WE
#4.Create a multivariate plot - Use the same plot as in 3 but add another important variable using colored symbols. Describe Figure. Make sure to add legend [scatterplot, description]
attach(ds1)
plot(trestbps, chol, main="Heart Attack",
xlab=" ", ylab="", pch=19)
par(new=T)
cp<-ds1$cp
plot(cp, chol, pch=3, axes=F, xlab="RestingBloodPressure",ylab="")
axis(side=4)
mtext(side=4,line=3.8,"Blood Pressure")
legend("topright", legend=c("Blood Pressure","Chest Pain"), pch=c(1,3))
