ANALISIS DE DATOS DE ABALONE

#Carga de Datos

data=read.csv("https://raw.githubusercontent.com/geovannychoez/prueba/master/abalone.data", header = FALSE)

#Renombrando las variables

names(data)=c('Sex','Length','Diameter','Height','Whole_weight','Shucked_weight','Viscera_weight','Shell_weight','Rings')

#Estructura de las Variables

str(data)
## 'data.frame':    4177 obs. of  9 variables:
##  $ Sex           : chr  "M" "M" "F" "M" ...
##  $ Length        : num  0.455 0.35 0.53 0.44 0.33 0.425 0.53 0.545 0.475 0.55 ...
##  $ Diameter      : num  0.365 0.265 0.42 0.365 0.255 0.3 0.415 0.425 0.37 0.44 ...
##  $ Height        : num  0.095 0.09 0.135 0.125 0.08 0.095 0.15 0.125 0.125 0.15 ...
##  $ Whole_weight  : num  0.514 0.226 0.677 0.516 0.205 ...
##  $ Shucked_weight: num  0.2245 0.0995 0.2565 0.2155 0.0895 ...
##  $ Viscera_weight: num  0.101 0.0485 0.1415 0.114 0.0395 ...
##  $ Shell_weight  : num  0.15 0.07 0.21 0.155 0.055 0.12 0.33 0.26 0.165 0.32 ...
##  $ Rings         : int  15 7 9 10 7 8 20 16 9 19 ...

##Distribución de la variable cualitativa Sexo (‘Sex’) ##Diagrama de Barras

library(highcharter)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
hchart(data$Sex, type = "column") %>% 
  hc_title(text = "Distribución de la variable 'Sex'")

##Distribución de la variable cualitativa anillos (‘Rings’) ##Diagrama de Barras

library(highcharter)
hchart(data$Rings, type = "column") %>% 
  hc_title(text = "Distribución de la variable 'Rings'")

##Diagrama de dispersión: Logitud vs Diametro

hchart(data, "scatter", hcaes(x = Length, y = Diameter)) %>%
  hc_title(text = "Diagrama de dispersión: Longitud mas Larga vs Diametro perpendicular a la longitud")

##Diagrama de dispersión: Peso Total vs Peso de la Concha sin carne

hchart(data, "scatter", hcaes(x = Whole_weight, y = Shell_weight)) %>% 
  hc_title(text = "Diagrama de dispersión: Peso Total vs Peso de la Concha sin carne")

##Estadística descriptiva multivariante

##Matriz de diagramas de dispersión

# pairs(data[, c('Length', 'Diameter', 'Whole_weight', 'Shell_weight')], 
#       main = "Matriz de diagramas de dispersión",
#       col = data$Sex)

library(psych)
 pairs.panels(data[,c(2,3,5,8)])

##Matriz de correlación

 library(corrplot)
## corrplot 0.92 loaded
 corrplot(cor(data[,c('Length', 'Diameter', 'Whole_weight', 'Shell_weight')]))