library(readr)
library(ggplot2)
datos<-data.frame(women)
datos
## height weight
## 1 58 115
## 2 59 117
## 3 60 120
## 4 61 123
## 5 62 126
## 6 63 129
## 7 64 132
## 8 65 135
## 9 66 139
## 10 67 142
## 11 68 146
## 12 69 150
## 13 70 154
## 14 71 159
## 15 72 164
str(datos)
## 'data.frame': 15 obs. of 2 variables:
## $ height: num 58 59 60 61 62 63 64 65 66 67 ...
## $ weight: num 115 117 120 123 126 129 132 135 139 142 ...
summary(datos)
## height weight
## Min. :58.0 Min. :115.0
## 1st Qu.:61.5 1st Qu.:124.5
## Median :65.0 Median :135.0
## Mean :65.0 Mean :136.7
## 3rd Qu.:68.5 3rd Qu.:148.0
## Max. :72.0 Max. :164.0
ggplot(data = datos, aes(x= height, y=weight))+
geom_point()
r<-cor(datos$weight, datos$height, method = "pearson")
r<-round(r,4) #presentar el resultado con 4 decimales
r
## [1] 0.9955
El coeficiente de correlacion 0.9955 esta entre los valores +0.90 y +1.00 indicando con esto una correlacion positiva muy fuerte, es decir que si se pueden tomar estos datos (altura y peso) como variables que se afectan.