data <- read.csv("https://archive.ics.uci.edu/ml/machine-learning-databases/heart-disease/processed.cleveland.data",header=FALSE,sep=",",na.strings = '?')

names(data) <- c( "edad", "sex", "cp", "trestbps", "chol","fbs", "restecg","thalach","exang", "oldpeak","slope", "ca", "thal", "num")

##Bloque 1

table(data$fbs)
## 
##   0   1 
## 258  45

##Histograma de trestbps

hist(data$trestbps,col = "light blue")

##Diagrama de Caja de trestbps

boxplot(data$trestbps,col = "light blue")

##Medidas estadisticas de trestbps

mean(data$trestbps)
## [1] 131.6898
median(data$trestbps)
## [1] 130
sd(data$trestbps)
## [1] 17.59975
quantile(data$trestbps)
##   0%  25%  50%  75% 100% 
##   94  120  130  140  200

##Histogrma de chol

hist(data$chol,col = "red")

##Diagrama de caja de chol

boxplot(data$chol,col = "red")

##Medidas estadisticas de chol

mean(data$chol)
## [1] 246.6931
median(data$chol)
## [1] 241
sd(data$chol)
## [1] 51.77692
quantile(data$chol)
##   0%  25%  50%  75% 100% 
##  126  211  241  275  564

##Histograma de thalach

hist(data$thalach,col = "blue")

##Diagrama de caja de thalach

boxplot(data$thalach,col = "yellow")

##Medidas estadisticas de thalach

mean(data$thalach)
## [1] 149.6073
median(data$thalach)
## [1] 153
sd(data$thalach)
## [1] 22.875
quantile(data$thalach)
##    0%   25%   50%   75%  100% 
##  71.0 133.5 153.0 166.0 202.0

##Histograma de oldpeak

hist(data$oldpeak,col = "purple")

##Diagrama de caja de oldpeak

boxplot(data$oldpeak,col = "orange")

##Medidas estadisticas de oldpeak

mean(data$oldpeak)
## [1] 1.039604
median(data$oldpeak)
## [1] 0.8
sd(data$oldpeak)
## [1] 1.161075
quantile(data$oldpeak)
##   0%  25%  50%  75% 100% 
##  0.0  0.0  0.8  1.6  6.2

##Tabla de frecuencias de exang

table(data$exang)
## 
##   0   1 
## 204  99

##Diagrana de barras de exang

x<- data$exang
y<- 1:303
plot(x,y)

##Matriz de correlacion de trestbps

z<- data$trestbps
y<- 1:303
cor(z,y)
## [1] -0.02202834

##Matriz de varianzas y covarianzas de trestbps

z<- data$trestbps
y<- 1:303
cov(z,y)
## [1] -33.96689

##Matriz de diagramas de dispersion de trestbps

z<- data$trestbps
y<- 1:303
plot(z,y)

##Matriz de correlacion de chol

f<- data$chol
y<- 1:303
cor(f,y)
## [1] -0.09551825

##Matriz de varianzas y covarianzas de chol

f<- data$chol
y<- 1:303
cov(f,y)
## [1] -433.3013

##Matriz de diagramas de dispersion de chol

f<- data$chol
y<- 1:303
plot(f,y)

##Matriz de correlacion de thalach

s<- data$thalach
y<- 1:303
cor(s,y)
## [1] -0.1054884

##Matriz de varianzas y covarianzas de thalach

s<- data$thalach
y<- 1:303
cov(s,y)
## [1] -211.4139

##Matriz de diagramas de dispersion de thalach

s<- data$thalach
y<- 1:303
plot(s,y)