Datos %>%
select(-c(pais,continente,continente2)) %>%
gather(key = "variable",value ="valor") %>%
group_by(variable) %>%
summarise(media=mean(valor,na.rm = T),
max=max(valor,na.rm=T),
min=min(valor,na.rm = T),
sd=sd(valor,na.rm = T),
mediana=median(valor,na.rm = T)) DTDatos %>%
select(-c(pais,continente,continente2)) %>%
gather(key = "variable",value ="valor") %>%
group_by(variable) %>%
summarise(media=mean(valor,na.rm = T),
max=max(valor,na.rm=T),
min=min(valor,na.rm = T),
sd=sd(valor,na.rm = T),
mediana=median(valor,na.rm = T)) %>%
datatable(data = .,extensions = 'Buttons',
options = list( scrollX = TRUE,
fixedColumns = TRUE,
dom = 'Bfrtip',buttons =
list('copy',
'print',
list( extend = 'collection',
buttons = c('csv',
'excel',
'pdf'),
text = 'Download'))))knitrDatos %>%
select(-c(pais,continente,continente2)) %>%
gather(key = "variable",value ="valor") %>%
group_by(variable) %>%
summarise(media=mean(valor,na.rm = T),
max=max(valor,na.rm=T),
min=min(valor,na.rm = T),
sd=sd(valor,na.rm = T),
mediana=median(valor,na.rm = T)) %>%
kable(format ="markdown" )| variable | media | max | min | sd | mediana |
|---|---|---|---|---|---|
| cajeros17 | 5.511960e+01 | 3.131528e+02 | 1.274667e+00 | 4.692907e+01 | 4.576590e+01 |
| camas14 | 2.291633e+00 | 6.200000e+00 | 5.000000e-01 | 1.571654e+00 | 1.600000e+00 |
| cto_pib16 | 3.026401e+00 | 2.822384e+01 | -1.362146e+01 | 3.751874e+00 | 3.062600e+00 |
| densidad17 | 4.493870e+02 | 2.047918e+04 | 1.368522e-01 | 2.051630e+03 | 9.467309e+01 |
| desempleo17 | 7.358919e+00 | 2.744400e+01 | 1.400000e-01 | 5.532971e+00 | 5.760000e+00 |
| deuda16 | 1.034774e+00 | 4.251210e+00 | 1.498000e-02 | 1.023584e+00 | 6.541850e-01 |
| electri16 | 8.435029e+01 | 1.000000e+02 | 7.588477e+00 | 2.638333e+01 | 1.000000e+02 |
| fertil16 | 4.176058e+02 | 3.023786e+04 | 4.020905e-01 | 2.442772e+03 | 1.193096e+02 |
| gasto_edu16 | 4.530416e+00 | 1.029313e+01 | 1.371020e+00 | 1.534184e+00 | 4.440990e+00 |
| gasto_id16 | 1.034774e+00 | 4.251210e+00 | 1.498000e-02 | 1.023584e+00 | 6.541850e-01 |
| gasto_militar17 | 1.863974e+00 | 1.207272e+01 | 0.000000e+00 | 1.615046e+00 | 1.436931e+00 |
| pib16 | 3.788623e+11 | 1.870719e+13 | 3.657261e+07 | 1.633312e+12 | 2.695857e+10 |
| pm2517 | 2.695940e+01 | 9.973437e+01 | 5.861331e+00 | 1.882999e+01 | 2.156899e+01 |
| pobRural17 | 3.901814e+01 | 8.729400e+01 | 0.000000e+00 | 2.382689e+01 | 3.826900e+01 |
| tierrasCult16 | 1.417527e+01 | 5.964669e+01 | 8.628130e-02 | 1.349633e+01 | 1.042367e+01 |
ggplotly(
Datos %>%
ggplot(.,aes(x=gasto_militar17,y=gasto_edu16, label=pais))+
theme_bw()+
geom_point()+
geom_smooth(method = "lm",
se = F)
)pairs.panels(
Datos %>%
select(gasto_militar17,
gasto_edu16,
desempleo17,
camas14,pib16,
gasto_id16) %>%
select_if(is.numeric))#Obtener correlaciones
matriz_cor <- cor(Datos %>%
select(gasto_militar17,
gasto_edu16,
desempleo17,
camas14,pib16,
gasto_id16),
use = "pairwise.complete.obs")
matriz_cor## gasto_militar17 gasto_edu16 desempleo17 camas14
## gasto_militar17 1.000000000 0.005680844 0.07243089 -0.08380492
## gasto_edu16 0.005680844 1.000000000 0.18996210 0.39890799
## desempleo17 0.072430891 0.189962103 1.00000000 0.09568141
## camas14 -0.083804924 0.398907991 0.09568141 1.00000000
## pib16 0.049793587 -0.039946838 -0.08014070 0.12298349
## gasto_id16 -0.073199552 -0.103750960 -0.15564109 0.55237344
## pib16 gasto_id16
## gasto_militar17 0.04979359 -0.07319955
## gasto_edu16 -0.03994684 -0.10375096
## desempleo17 -0.08014070 -0.15564109
## camas14 0.12298349 0.55237344
## pib16 1.00000000 0.37707683
## gasto_id16 0.37707683 1.00000000
corrplot( cor(
Datos %>% select_if(is.numeric),
use = "pairwise.complete.obs",
method = "pearson"),
method = "color",
type = "upper",
diag = F,
addgrid.col = "black",
tl.col = "black",
tl.srt = 45,
tl.cex = .8,
col= brewer.pal("BrBG",n=10)
)