Está en la página 1de 36

Encuesta

Julian Mendieta-Camila Sandoval-Cristian Trujillo

2023-09-27

{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

Encuesta:
Cargar Librerias:
library(tidyverse) # ciencia de datos

## -- Attaching core tidyverse packages ------------------------


tidyverse 2.0.0 --
## v dplyr 1.1.2 v readr 2.1.4
## v forcats 1.0.0 v stringr 1.5.0
## v ggplot2 3.4.3 v tibble 3.2.1
## v lubridate 1.9.2 v tidyr 1.3.0
## v purrr 1.0.1
## -- Conflicts ------------------------------------------
tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## i Use the conflicted package (<http://conflicted.r-lib.org/>) to force
all conflicts to become errors

library(flextable) # diseño de tablas

##
## Attaching package: 'flextable'
##
## The following object is masked from 'package:purrr':
##
## compose

library(janitor) # tablas de frecuencias

##
## Attaching package: 'janitor'
##
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test

library(ggplot2) # hacer gráficas elegantes


library(moments) # calcular los momentos
library(readxl) # leer archivos excel
library(modeest) #la moda

##
## Attaching package: 'modeest'
##
## The following object is masked from 'package:moments':
##
## skewness

Cargar Datos:
Respuestas <- read_excel("Salud Mental (Respuestas) 2.xlsx")
Clasificacion De Variables
Variables Categoricas:
1.¿Có mo clasificarías tu salud Mental?
2.¿Cuá l de los siguientes ejemplos has llegado a tener o a punto?
3.En situaciones como la anterior, ¿Qué haces para calmarte?
4.¿consideras que tu salud mental es afectada por tus padres?
5.De los siguientes ejemplos, ¿Cual consideras afecta má s tu salud mental?
Variables Cuantitativas
1.¿Qué edad tienes?
2.¿Cuá ntas veces al día te llega a dar ansiedad?
3.¿Qué nivel de ansiedad tienes del 1 al 10?
4.¿Aproximadamente, cuá nto tiempo utilizas para relajarte?
5.Del 1 al 10, ¿Qué tanto han afectado en tu salud mental tus maestros?

Tablas de distribucion Variables Categoricas


Respuestas %>% tabyl(Clasificacion_salud_mental) %>%
adorn_pct_formatting() %>%
adorn_totals("row") %>% flextable() %>% fontsize(size = 14,part =
"head")%>% autofit() %>% theme_vader()

Clasificacion_salud_menta
n percent
l
buena 14 28.0%

mala 5 10.0%

media 20 40.0%

no tan buena 11 22.0%

Total 50 -
Respuestas %>% tabyl(Clasificacion_salud_mental) %>%

ggplot(aes(x=Clasificacion_salud_mental,y=percent,fill=Clasificacion_salu
d_mental)) + geom_col() +geom_text(aes(label=sprintf("%.f%
%",100*percent)),vjust=1.5, col="white",fontface="bold")
+guides(fill=FALSE) + labs(x="playa", y="número de nidos",title="número
de nidos por playa ")

## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use


"none" instead as
## of ggplot2 3.3.4.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning
was
## generated.
Respuestas %>% tabyl(Experiencias) %>% adorn_pct_formatting() %>%
adorn_totals("row") %>% flextable() %>% fontsize(size = 14,part =
"head")%>% autofit() %>% theme_vader()

Experiencias n percent
Afecciones adictivas 3 6.0%

Ansiedad 9 18.0%

Conducta agresiva 7 14.0%

Depresión 9 18.0%

Estrés 22 44.0%

Total 50 -
Respuestas %>% tabyl(Experiencias) %>%
ggplot(aes(x=Experiencias,y=percent,fill=Experiencias)) + geom_col()
+geom_text(aes(label=sprintf("%.f%%",100*percent)),vjust=1.5,
col="white",fontface="bold")+guides(fill=FALSE) + labs(x="playa",
y="número de nidos",title="número de nidos por playa ")
Respuestas %>% tabyl(Acciones_de_calma) %>% adorn_pct_formatting() %>%
adorn_totals("row") %>% flextable() %>% fontsize(size = 14,part =
"head")%>% autofit() %>% theme_vader()

Acciones_de_calma n percent
Dibujar 4 8.0%

Distanciarse 6 12.0%

Escuchar Musica 26 52.0%

Hacer caso omiso 4 8.0%

Leer 6 12.0%

Ninguna de las anteriores 4 8.0%

Total 50 -
Respuestas %>% tabyl(Acciones_de_calma) %>%
ggplot(aes(x=Acciones_de_calma,y=percent,fill=Acciones_de_calma)) +
geom_col() +geom_text(aes(label=sprintf("%.f%%",100*percent)),vjust=1.5,
col="white",fontface="bold")+guides(fill=FALSE) + labs(x="playa",
y="número de nidos",title="número de nidos por playa ")
Respuestas %>% tabyl(afectacion_por_parte_de_padres) %>%
adorn_pct_formatting() %>%
adorn_totals("row") %>% flextable() %>% fontsize(size = 14,part =
"head")%>% autofit() %>% theme_vader()

afectacion_por_parte_de_padre
n percent
s
no 25 50.0%

si 25 50.0%

Total 50 -
Respuestas %>% tabyl(afectacion_por_parte_de_padres) %>%

ggplot(aes(x=afectacion_por_parte_de_padres,y=percent,fill=afectacion_por
_parte_de_padres)) + geom_col() +geom_text(aes(label=sprintf("%.f%
%",100*percent)),vjust=1.5, col="white",fontface="bold")
+guides(fill=FALSE) + labs(x="playa", y="número de nidos",title="número
de nidos por playa ")
Respuestas %>% tabyl(cosas_que_afectan_tu_salud) %>%
adorn_pct_formatting() %>%
adorn_totals("row") %>% flextable() %>% fontsize(size = 14,part =
"head")%>% autofit() %>% theme_vader()

cosas_que_afectan_tu_salu
n percent
d
Cambios sociales rápidos 12 24.0%

Estudio 25 50.0%

Padres 6 12.0%

Redes Sociales 7 14.0%

Total 50 -
Respuestas %>% tabyl(cosas_que_afectan_tu_salud) %>%

ggplot(aes(x=cosas_que_afectan_tu_salud,y=percent,fill=cosas_que_afectan_
tu_salud)) + geom_col() +geom_text(aes(label=sprintf("%.f%
%",100*percent)),vjust=1.5, col="white",fontface="bold")
+guides(fill=FALSE) + labs(x="playa", y="número de nidos",title="número
de nidos por playa ")

tablas de distribucion Variables Cuantitativas


Respuestas%>%
mutate(grupos=cut(Edad,breaks=5))%>%
group_by(grupos)%>%
summarise(frecuencias=n())%>%adorn_totals()%>%flextable()%>
%theme_vader()%>%
set_caption("profundidad de nido")

profundidad de nido
frecuen
grupos
cias

(14,15] 25

(15,16] 12

(16,17] 10

(17,18] 1
frecuen
grupos
cias

(18,19] 2

Total 50
Respuestas%>%
ggplot(aes(x=Edad))+geom_histogram(color="orange",fill="lightblue",bins
= 6)

Respuestas%>%
mutate(grupos=cut(Frecuencia_de_ansiedad_por_dia,breaks=6))%>%
group_by(grupos)%>%
summarise(frecuencias=n())%>%adorn_totals()%>%flextable()%>
%theme_vader()%>%
set_caption("profundidad de nido")

profundidad de nido
frecuen
grupos
cias

(0.992,2.
25
33]

(2.33,3.6
8
7]

(3.67,5] 11

(5,6.33] 2

(6.33,7.6
2
7]

(7.67,9.0
2
1]

Total 50
Respuestas%>%
ggplot(aes(x=Frecuencia_de_ansiedad_por_dia))
+geom_histogram(color="orange",fill="lightblue",bins = 9)
Respuestas%>%
mutate(grupos=cut(nivel_de_ansiedad,breaks=6))%>%
group_by(grupos)%>%
summarise(frecuencias=n())%>%adorn_totals()%>%flextable()%>
%theme_vader()%>%
set_caption("profundidad de nido")

profundidad de nido
frecuen
grupos
cias

(0.991,2.
5
5]

(2.5,4] 11

(4,5.5] 6

(5.5,7] 16

(7,8.5] 4

(8.5,10] 8

Total 50
Respuestas%>%
ggplot(aes(x=nivel_de_ansiedad))
+geom_histogram(color="orange",fill="lightblue",bins = 9)
Respuestas%>%
mutate(grupos=cut(Tiempo_de_relajacion,breaks=6))%>%
group_by(grupos)%>%
summarise(frecuencias=n())%>%adorn_totals()%>%flextable()%>
%theme_vader()%>%
set_caption("profundidad de nido")

profundidad de nido
frecuen
grupos
cias

(4.57,77.
34
5]

(77.5,15
11
0]

(150,222
1
]

(222,295
3
]

(368,440
1
]

Total 50
Respuestas%>%
ggplot(aes(x=Tiempo_de_relajacion))
+geom_histogram(color="orange",fill="lightblue",bins = 9)
Respuestas%>%
mutate(grupos=cut(afectacion_de_salud_mental_por_maestros,breaks=6))%>%
group_by(grupos)%>%
summarise(frecuencias=n())%>%adorn_totals()%>%flextable()%>
%theme_vader()%>%
set_caption("profundidad de nido")

profundidad de nido
frecuen
grupos
cias

(0.991,2.
7
5]

(2.5,4] 9

(4,5.5] 5

(5.5,7] 12

(7,8.5] 5

(8.5,10] 12

Total 50
Respuestas%>%
ggplot(aes(x=afectacion_de_salud_mental_por_maestros))
+geom_histogram(color="orange",fill="lightblue",bins = 9)
Medidas Descriptivas
medias<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),mean,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"media")

## Warning: There was 1 warning in `summarize()`.


## i In argument: `across(...)`.
## Caused by warning:
## ! The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
## Supply arguments directly to `.fns` through an anonymous function
instead.
##
## # Previously
## across(a:b, mean, na.rm = TRUE)
##
## # Now
## across(a:b, \(x) mean(x, na.rm = TRUE))

medianas<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),median,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"Mediana")
tabla1<-full_join(medias,medianas)

## Joining with `by = join_by(variables)`

tabla1%>%flextable()%>%autofit()

variables media Mediana

Edad 15.80 15.5

Frecuencia_de_ansiedad_por_dia 3.06 2.5

nivel_de_ansiedad 5.90 6.0


variables media Mediana

Tiempo_de_relajacion 71.60 60.0

afectacion_de_salud_mental_por_maestros 6.18 6.5


moda<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),mlv,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"Moda")

## Warning: There were 8 warnings in `summarize()`.


## The first warning was:
## i In argument: `across(...)`.
## Caused by warning:
## ! argument 'method' is missing. Data are supposed to be continuous.
## Default method 'shorth' is used
## i Run `dplyr::last_dplyr_warnings()` to see the 7 remaining warnings.

tabla2<-full_join(tabla1,moda)

## Joining with `by = join_by(variables)`

tabla2%>%flextable()

variable
media Mediana Moda
s

Edad 15.80 15.5 15.24

Frecuen
cia_de_
ansieda 3.06 2.5 1.56
d_por_di
a

nivel_de
_ansied 5.90 6.0 5.64
ad

Tiempo_
de_relaj 71.60 60.0 28.00
acion

afectaci
on_de_s
alud_me
6.18 6.5 8.60
ntal_por
_maestr
os
desviacion<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),sd,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"desviacion estandar")
tabla3<-full_join(tabla2,desviacion)

## Joining with `by = join_by(variables)`

tabla3%>%flextable()
desviaci
variable
media Mediana Moda on
s
estandar

1.14285
Edad 15.80 15.5 15.24
7

Frecuen
cia_de_
2.00417
ansieda 3.06 2.5 1.56
9
d_por_di
a

nivel_de
2.39259
_ansied 5.90 6.0 5.64
1
ad

Tiempo_
82.5266
de_relaj 71.60 60.0 28.00
81
acion

afectaci
on_de_s
alud_me 2.84777
6.18 6.5 8.60
ntal_por 0
_maestr
os
asimetria<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),skewness,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"coeficiente de asimetria")

## Warning: There were 3 warnings in `summarize()`.


## The first warning was:
## i In argument: `across(...)`.
## Caused by warning:
## ! encountered a tie, and the difference between minimal and
## maximal value is > length('x') * 'tie.limit'
## the distribution could be multimodal
## i Run `dplyr::last_dplyr_warnings()` to see the 2 remaining warnings.

tabla4<-full_join(tabla3,asimetria)

## Joining with `by = join_by(variables)`

tabla4%>%flextable()

coeficien
desviaci
variable te de
media Mediana Moda on
s asimetri
estandar
a

1.14285 0.86821
Edad 15.80 15.5 15.24
7 875

Frecuen
cia_de_
2.00417 1.24607
ansieda 3.06 2.5 1.56
9 606
d_por_di
a

nivel_de
2.39259 0.01927
_ansied 5.90 6.0 5.64
1 519
ad
coeficien
desviaci
variable te de
media Mediana Moda on
s asimetri
estandar
a

Tiempo_
82.5266 2.22225
de_relaj 71.60 60.0 28.00
81 790
acion

afectaci
on_de_s
-
alud_me 2.84777
6.18 6.5 8.60 0.12113
ntal_por 0
253
_maestr
os
curtosis<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),kurtosis,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"coeficiente de concentracion")
tabla5<-full_join(tabla4,curtosis)

## Joining with `by = join_by(variables)`

tabla5%>%flextable()

coeficien coeficien
desviaci
variable te de te de
media Mediana Moda on
s asimetri concentr
estandar
a acion

1.14285 0.86821 3.59375


Edad 15.80 15.5 15.24
7 875 0

Frecuen
cia_de_
2.00417 1.24607 4.35278
ansieda 3.06 2.5 1.56
9 606 5
d_por_di
a

nivel_de
2.39259 0.01927 2.25307
_ansied 5.90 6.0 5.64
1 519 2
ad

Tiempo_
82.5266 2.22225 9.56608
de_relaj 71.60 60.0 28.00
81 790 7
acion

afectaci
on_de_s
-
alud_me 2.84777 1.86257
6.18 6.5 8.60 0.12113
ntal_por 0 2
253
_maestr
os
minimo<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),min,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"minimo")
tabla6<-full_join(tabla5,minimo)

## Joining with `by = join_by(variables)`


tabla6%>%flextable()

coeficien coeficien
desviaci
variable te de te de
media Mediana Moda on minimo
s asimetri concentr
estandar
a acion

1.14285 0.86821 3.59375


Edad 15.80 15.5 15.24 14
7 875 0

Frecuen
cia_de_
2.00417 1.24607 4.35278
ansieda 3.06 2.5 1.56 1
9 606 5
d_por_di
a

nivel_de
2.39259 0.01927 2.25307
_ansied 5.90 6.0 5.64 1
1 519 2
ad

Tiempo_
82.5266 2.22225 9.56608
de_relaj 71.60 60.0 28.00 5
81 790 7
acion

afectaci
on_de_s
-
alud_me 2.84777 1.86257
6.18 6.5 8.60 0.12113 1
ntal_por 0 2
253
_maestr
os
maximo<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),max,na.rm=TRUE)

)%>%pivot_longer(everything(),names_to = "variables",values_to =
"maximo")
tabla7<-full_join(tabla6,maximo)

## Joining with `by = join_by(variables)`

tabla7%>%flextable()%>%autofit()%>%theme_tron()%>
%set_caption("estadisticas descriptivas")

estadisticas descriptivas
coeficie
media Mediana Moda desviacion estandar coeficiente de asimetria
concent

15.80 15.5 15.24 1.142857 0.86821875 3.5

_dia 3.06 2.5 1.56 2.004179 1.24607606 4.3

5.90 6.0 5.64 2.392591 0.01927519 2.2

71.60 60.0 28.00 82.526681 2.22225790 9.5

por_maestros 6.18 6.5 8.60 2.847770 -0.12113253 1.8

Coeficiente de variación
meansd<-function(x){
media=mean(x,na.rm=TRUE)
sd=sd(x,na.rm = TRUE)

sprintf("%.2f+/-%.2f",media,sd)
}

desme<-Respuestas%>%
summarize(

across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,Tiempo_de_
relajacion,afectacion_de_salud_mental_por_maestros),meansd))%>%
pivot_longer(everything(),names_to = "variables",values_to = "media+/-
desviacion")

coefvariacion<- function(x){
media=mean(x,na.rm=T)
desviacion=sd(x,na.rm=T)
cv=desviacion/media*100
sprintf("%.1f%%",cv)
}

variacion<-Respuestas%>%

summarize(across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,
Tiempo_de_relajacion,afectacion_de_salud_mental_por_maestros),coefvariaci
on))%>%
pivot_longer(everything(),names_to = "variables",values_to =
"coeficiente de variacion")

tablaAa<-full_join(desme,variacion)

## Joining with `by = join_by(variables)`

tablaAa%>%flextable()

coeficien
media+/-
variable te de
desviaci
s variacio
on
n

15.80+/-
Edad 7.2%
1.14

Frecuen
cia_de_
3.06+/-
ansieda 65.5%
2.00
d_por_di
a

nivel_de
5.90+/-
_ansied 40.6%
2.39
ad

Tiempo_
71.60+/-
de_relaj 115.3%
82.53
acion

afectaci
on_de_s
alud_me 6.18+/-
46.1%
ntal_por 2.85
_maestr
os

Medidas de localizacion
medianacuartiles<- function(x){
mediana=median(x,na.rm = T)
Q1= quantile(x,na.rm=T,prob=0.25)
Q3= quantile(x,na.rm=T,prob=0.75)
sprintf("%.1f [%.1f , %.1f]",mediana,Q1,Q3)

Respuestas%>%
summarize(across(c(Edad,Frecuencia_de_ansiedad_por_dia,nivel_de_ansiedad,
Tiempo_de_relajacion,afectacion_de_salud_mental_por_maestros),medianacuar
tiles))%>%
pivot_longer(everything(),names_to = "variables",values_to = "mediana,
[cuartil1, cuartil 2]")%>%
flextable()%>%
colformat_double(digits = 2)%>%
autofit()%>% theme_zebra()%>%set_caption("mediana y rango
intercuartilico")

mediana y rango intercuartilico


mediana, [cuartil1, cuartil
variables
2]

Edad 15.5 [15.0 , 16.8]

Frecuencia_de_ansiedad_por_dia 2.5 [2.0 , 4.0]

nivel_de_ansiedad 6.0 [4.0 , 7.0]

Tiempo_de_relajacion 60.0 [15.0 , 112.5]

afectacion_de_salud_mental_por_maestros 6.5 [4.0 , 8.0]

Graficos de Caja
Edad
Respuestas %>%
ggplot(aes(x = Edad, y = Clasificacion_salud_mental, color =
Clasificacion_salud_mental)) +
geom_boxplot()

Respuestas %>%
ggplot(aes(x = Edad, y = Experiencias, color = Experiencias)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = Edad, y = Acciones_de_calma, color = Acciones_de_calma))
+
geom_boxplot()

Respuestas %>%
ggplot(aes(x = Edad, y = afectacion_por_parte_de_padres, color =
afectacion_por_parte_de_padres)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = Edad, y = cosas_que_afectan_tu_salud, color =
cosas_que_afectan_tu_salud)) +
geom_boxplot()

Frecuencia de ansiedad por dia


Respuestas %>%
ggplot(aes(x = Frecuencia_de_ansiedad_por_dia, y =
Clasificacion_salud_mental, color = Clasificacion_salud_mental)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = Frecuencia_de_ansiedad_por_dia, y = Experiencias, color
= Experiencias)) +
geom_boxplot()

Respuestas %>%
ggplot(aes(x = Frecuencia_de_ansiedad_por_dia, y = Acciones_de_calma,
color = Acciones_de_calma)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = Frecuencia_de_ansiedad_por_dia, y =
afectacion_por_parte_de_padres, color = afectacion_por_parte_de_padres))
+
geom_boxplot()

Respuestas %>%
ggplot(aes(x = Frecuencia_de_ansiedad_por_dia, y =
cosas_que_afectan_tu_salud, color = cosas_que_afectan_tu_salud)) +
geom_boxplot()
Nivel de ansiedad
Respuestas %>%
ggplot(aes(x = nivel_de_ansiedad, y = Clasificacion_salud_mental, color
= Clasificacion_salud_mental)) +
geom_boxplot()

Respuestas %>%
ggplot(aes(x = nivel_de_ansiedad, y = Experiencias, color =
Experiencias)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = nivel_de_ansiedad, y = Acciones_de_calma, color =
Acciones_de_calma)) +
geom_boxplot()

Respuestas %>%
ggplot(aes(x = nivel_de_ansiedad, y = afectacion_por_parte_de_padres,
color = afectacion_por_parte_de_padres)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = nivel_de_ansiedad, y = cosas_que_afectan_tu_salud, color
= cosas_que_afectan_tu_salud)) +
geom_boxplot()

Tiempo de Relajacion
Respuestas %>%
ggplot(aes(x = Tiempo_de_relajacion, y = Clasificacion_salud_mental,
color = Clasificacion_salud_mental)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = Tiempo_de_relajacion, y = Experiencias, color =
Experiencias)) +
geom_boxplot()

Respuestas %>%
ggplot(aes(x = Tiempo_de_relajacion, y = Acciones_de_calma, color =
Acciones_de_calma)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = Tiempo_de_relajacion, y =
afectacion_por_parte_de_padres, color = afectacion_por_parte_de_padres))
+
geom_boxplot()

Respuestas %>%
ggplot(aes(x = Tiempo_de_relajacion, y = cosas_que_afectan_tu_salud,
color = cosas_que_afectan_tu_salud)) +
geom_boxplot()
Afectacion de salud mental por maestros
Respuestas %>%
ggplot(aes(x = afectacion_de_salud_mental_por_maestros, y =
Clasificacion_salud_mental, color = Clasificacion_salud_mental)) +
geom_boxplot()

Respuestas %>%
ggplot(aes(x = afectacion_de_salud_mental_por_maestros, y =
Experiencias, color = Experiencias)) +
geom_boxplot()
Respuestas %>%
ggplot(aes(x = afectacion_de_salud_mental_por_maestros, y =
Acciones_de_calma, color = Acciones_de_calma)) +
geom_boxplot()

Respuestas %>%
ggplot(aes(x = afectacion_de_salud_mental_por_maestros, y =
afectacion_por_parte_de_padres, color = afectacion_por_parte_de_padres))
+
geom_boxplot()
Respuestas %>%
ggplot(aes(x = afectacion_de_salud_mental_por_maestros, y =
cosas_que_afectan_tu_salud, color = cosas_que_afectan_tu_salud)) +
geom_boxplot()

Tablas de contingencia
Clasificacion salud mental
Respuestas%>%
tabyl(Clasificacion_salud_mental,Experiencias,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

ficacion_salud_mental Afecciones adictivas Ansiedad Conducta agresiva Depresión Estrés Total

a 0.0% (0) 55.6% (5) 28.6% (2) 11.1% (1) 27.3% (6) 28.0% (1

0.0% (0) 0.0% (0) 28.6% (2) 22.2% (2) 4.5% (1) 10.0% (
ficacion_salud_mental Afecciones adictivas Ansiedad Conducta agresiva Depresión Estrés Total

a 100.0% (3) 22.2% (2) 28.6% (2) 22.2% (2) 50.0% (11) 40.0% (2

n buena 0.0% (0) 22.2% (2) 14.3% (1) 44.4% (4) 18.2% (4) 22.0% (1
Respuestas%>%
tabyl(Clasificacion_salud_mental,Experiencias,show_na=F)%>%
adorn_percentages("col")%>%
pivot_longer(cols = -1,names_to = "experiencias",values_to =
"porcentaje")%>%
mutate(proporcion=porcentaje*100)%>%

ggplot(aes(x=experiencias,y=proporcion,fill=Clasificacion_salud_mental))
+geom_col(position = "dodge")+
geom_text(aes(label=sprintf("%.2f%%",porcentaje)),position =
position_dodge(width = 0.7),vjust=1.5,col="white",fontface="bold")+
labs(fill="Porcentaje de tortugas por periodo")

Respuestas%>%
tabyl(Clasificacion_salud_mental,Acciones_de_calma,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

d_mental Dibujar Distanciarse Escuchar Musica Hacer caso omiso Leer Ninguna de las anteriore

0.0% (0) 16.7% (1) 30.8% (8) 25.0% (1) 50.0% (3) 25.0% (1)

0.0% (0) 16.7% (1) 7.7% (2) 25.0% (1) 16.7% (1) 0.0% (0)

25.0% (1) 66.7% (4) 38.5% (10) 25.0% (1) 33.3% (2) 50.0% (2)

75.0% (3) 0.0% (0) 23.1% (6) 25.0% (1) 0.0% (0) 25.0% (1)
Respuestas%>%
tabyl(Clasificacion_salud_mental,Acciones_de_calma,show_na=F)%>%
adorn_percentages("col")%>%
pivot_longer(cols = -1,names_to = "acciones_de_calma",values_to =
"porcentaje")%>%
mutate(proporcion=porcentaje*100)%>%

ggplot(aes(x=acciones_de_calma,y=proporcion,fill=Clasificacion_salud_ment
al))+geom_col(position = "dodge")+
geom_text(aes(label=sprintf("%.2f%%",porcentaje)),position =
position_dodge(width = 0.7),vjust=1.5,col="white",fontface="bold")+
labs(fill="Porcentaje de tortugas por periodo")

Respuestas%>%

tabyl(Clasificacion_salud_mental,afectacion_por_parte_de_padres,show_na=F
)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Clasificacion_salud_mental no si Total

buena 36.0% (9) 20.0% (5) 28.0% (14)

mala 8.0% (2) 12.0% (3) 10.0% (5)

media 44.0% (11) 36.0% (9) 40.0% (20)

no tan buena 12.0% (3) 32.0% (8) 22.0% (11)


Respuestas%>%
tabyl(Clasificacion_salud_mental,afectacion_por_parte_de_padres
,show_na=F)%>%
adorn_percentages("col")%>%
pivot_longer(cols = -1,names_to =
"Afectacion_por_parte_de_padres",values_to = "porcentaje")%>%
mutate(proporcion=porcentaje*100)%>%

ggplot(aes(x=Afectacion_por_parte_de_padres,y=proporcion,fill=Clasificaci
on_salud_mental))+geom_col(position = "dodge")+
geom_text(aes(label=sprintf("%.2f%%",porcentaje)),position =
position_dodge(width = 0.7),vjust=1.5,col="white",fontface="bold")+
labs(fill="Porcentaje de tortugas por periodo")
Respuestas%>%
tabyl(Clasificacion_salud_mental,cosas_que_afectan_tu_salud,show_na=F)
%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Clasificacion_salud_mental Cambios sociales rápidos Estudio Padres Redes Sociales Total

buena 25.0% (3) 32.0% (8) 33.3% (2) 14.3% (1) 28.0% (14)

mala 8.3% (1) 12.0% (3) 16.7% (1) 0.0% (0) 10.0% (5)

media 50.0% (6) 40.0% (10) 16.7% (1) 42.9% (3) 40.0% (20)

no tan buena 16.7% (2) 16.0% (4) 33.3% (2) 42.9% (3) 22.0% (11)

Experiencias
Respuestas%>%
tabyl(Experiencias,Clasificacion_salud_mental
,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Experiencias buena mala media no tan buena Total

Afecciones adictivas 0.0% (0) 0.0% (0) 15.0% (3) 0.0% (0) 6.0% (3)

Ansiedad 35.7% (5) 0.0% (0) 10.0% (2) 18.2% (2) 18.0% (9)

Conducta agresiva 14.3% (2) 40.0% (2) 10.0% (2) 9.1% (1) 14.0% (7)

Depresión 7.1% (1) 40.0% (2) 10.0% (2) 36.4% (4) 18.0% (9)

Estrés 42.9% (6) 20.0% (1) 55.0% (11) 36.4% (4) 44.0% (22)
Respuestas%>%
tabyl(Experiencias,Acciones_de_calma,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()
Dibujar Distanciarse Escuchar Musica Hacer caso omiso Leer Ninguna de las anteriores

ctivas 0.0% (0) 0.0% (0) 0.0% (0) 25.0% (1) 16.7% (1) 25.0% (1)

0.0% (0) 16.7% (1) 15.4% (4) 25.0% (1) 33.3% (2) 25.0% (1)

siva 25.0% (1) 16.7% (1) 15.4% (4) 25.0% (1) 0.0% (0) 0.0% (0)

50.0% (2) 16.7% (1) 19.2% (5) 0.0% (0) 16.7% (1) 0.0% (0)

25.0% (1) 50.0% (3) 50.0% (13) 25.0% (1) 33.3% (2) 50.0% (2)
Respuestas%>%
tabyl(Experiencias,afectacion_por_parte_de_padres,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Experiencias no si Total

Afecciones adictivas 8.0% (2) 4.0% (1) 6.0% (3)

Ansiedad 16.0% (4) 20.0% (5) 18.0% (9)

Conducta agresiva 8.0% (2) 20.0% (5) 14.0% (7)

Depresión 20.0% (5) 16.0% (4) 18.0% (9)

Estrés 48.0% (12) 40.0% (10) 44.0% (22)


Respuestas%>%
tabyl(Experiencias,cosas_que_afectan_tu_salud,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Experiencias Cambios sociales rápidos Estudio Padres Redes Sociales Total

Afecciones adictivas 8.3% (1) 4.0% (1) 0.0% (0) 14.3% (1) 6.0% (3)

Ansiedad 16.7% (2) 16.0% (4) 50.0% (3) 0.0% (0) 18.0% (9)

Conducta agresiva 8.3% (1) 12.0% (3) 50.0% (3) 0.0% (0) 14.0% (7)

Depresión 25.0% (3) 8.0% (2) 0.0% (0) 57.1% (4) 18.0% (9)

Estrés 41.7% (5) 60.0% (15) 0.0% (0) 28.6% (2) 44.0% (22)

Acciones de calma
Respuestas%>%
tabyl(Acciones_de_calma,Clasificacion_salud_mental,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Acciones_de_calma buena mala media no tan buena Total

Dibujar 0.0% (0) 0.0% (0) 5.0% (1) 27.3% (3) 8.0% (4)

Distanciarse 7.1% (1) 20.0% (1) 20.0% (4) 0.0% (0) 12.0% (6)

Escuchar Musica 57.1% (8) 40.0% (2) 50.0% (10) 54.5% (6) 52.0% (26)

Hacer caso omiso 7.1% (1) 20.0% (1) 5.0% (1) 9.1% (1) 8.0% (4)

Leer 21.4% (3) 20.0% (1) 10.0% (2) 0.0% (0) 12.0% (6)

Ninguna de las anteriores 7.1% (1) 0.0% (0) 10.0% (2) 9.1% (1) 8.0% (4)
Acciones_de_calma buena mala media no tan buena Total

Respuestas%>%
tabyl(Acciones_de_calma,Experiencias,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

ones_de_calma Afecciones adictivas Ansiedad Conducta agresiva Depresión Estrés Total

ujar 0.0% (0) 0.0% (0) 14.3% (1) 22.2% (2) 4.5% (1) 8.0% (4)

anciarse 0.0% (0) 11.1% (1) 14.3% (1) 11.1% (1) 13.6% (3) 12.0% (6

uchar Musica 0.0% (0) 44.4% (4) 57.1% (4) 55.6% (5) 59.1% (13) 52.0% (2

er caso omiso 33.3% (1) 11.1% (1) 14.3% (1) 0.0% (0) 4.5% (1) 8.0% (4)

r 33.3% (1) 22.2% (2) 0.0% (0) 11.1% (1) 9.1% (2) 12.0% (6

guna de las anteriores 33.3% (1) 11.1% (1) 0.0% (0) 0.0% (0) 9.1% (2) 8.0% (4)
Respuestas%>%
tabyl(Acciones_de_calma,afectacion_por_parte_de_padres,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Acciones_de_calma no si Total

Dibujar 12.0% (3) 4.0% (1) 8.0% (4)

Distanciarse 0.0% (0) 24.0% (6) 12.0% (6)

Escuchar Musica 52.0% (13) 52.0% (13) 52.0% (26)

Hacer caso omiso 12.0% (3) 4.0% (1) 8.0% (4)

Leer 12.0% (3) 12.0% (3) 12.0% (6)

Ninguna de las anteriores 12.0% (3) 4.0% (1) 8.0% (4)


Respuestas%>%
tabyl(Acciones_de_calma,cosas_que_afectan_tu_salud,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

Acciones_de_calma Cambios sociales rápidos Estudio Padres Redes Sociales Total

Dibujar 16.7% (2) 0.0% (0) 0.0% (0) 28.6% (2) 8.0% (4)

Distanciarse 0.0% (0) 20.0% (5) 16.7% (1) 0.0% (0) 12.0% (6)

Escuchar Musica 41.7% (5) 56.0% (14) 50.0% (3) 57.1% (4) 52.0% (26)

Hacer caso omiso 0.0% (0) 8.0% (2) 16.7% (1) 14.3% (1) 8.0% (4)

Leer 33.3% (4) 8.0% (2) 0.0% (0) 0.0% (0) 12.0% (6)

Ninguna de las anteriores 8.3% (1) 8.0% (2) 16.7% (1) 0.0% (0) 8.0% (4)

Afectaciones por parte de padres


Respuestas%>%

tabyl(afectacion_por_parte_de_padres,Clasificacion_salud_mental,show_na=F
)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

afectacion_por_parte_de_padres buena mala media no tan buena Total

no 64.3% (9) 40.0% (2) 55.0% (11) 27.3% (3) 50.0% (25)

si 35.7% (5) 60.0% (3) 45.0% (9) 72.7% (8) 50.0% (25)
Respuestas%>%
tabyl(afectacion_por_parte_de_padres,Experiencias,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

on_por_parte_de_padres Afecciones adictivas Ansiedad Conducta agresiva Depresión Estrés Total

66.7% (2) 44.4% (4) 28.6% (2) 55.6% (5) 54.5% (12) 50.0%

33.3% (1) 55.6% (5) 71.4% (5) 44.4% (4) 45.5% (10) 50.0%
Respuestas%>%
tabyl(afectacion_por_parte_de_padres,Acciones_de_calma,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

_de_padres Dibujar Distanciarse Escuchar Musica Hacer caso omiso Leer Ninguna de las anterio

75.0% (3) 0.0% (0) 50.0% (13) 75.0% (3) 50.0% (3) 75.0% (3)

25.0% (1) 100.0% (6) 50.0% (13) 25.0% (1) 50.0% (3) 25.0% (1)
Respuestas%>%

tabyl(afectacion_por_parte_de_padres,cosas_que_afectan_tu_salud,show_na=F
)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

ectacion_por_parte_de_padres Cambios sociales rápidos Estudio Padres Redes Sociales Total

58.3% (7) 48.0% (12) 0.0% (0) 85.7% (6) 50.0% (25)

41.7% (5) 52.0% (13) 100.0% (6) 14.3% (1) 50.0% (25)

Cosas que afectan tu salud


Respuestas%>%
tabyl(cosas_que_afectan_tu_salud,Clasificacion_salud_mental,show_na=F)
%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

cosas_que_afectan_tu_salud buena mala media no tan buena Total

Cambios sociales rápidos 21.4% (3) 20.0% (1) 30.0% (6) 18.2% (2) 24.0% (12)

Estudio 57.1% (8) 60.0% (3) 50.0% (10) 36.4% (4) 50.0% (25)
cosas_que_afectan_tu_salud buena mala media no tan buena Total

Padres 14.3% (2) 20.0% (1) 5.0% (1) 18.2% (2) 12.0% (6)

Redes Sociales 7.1% (1) 0.0% (0) 15.0% (3) 27.3% (3) 14.0% (7)
Respuestas%>%
tabyl(cosas_que_afectan_tu_salud,Experiencias,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

_que_afectan_tu_salud Afecciones adictivas Ansiedad Conducta agresiva Depresión Estrés Total

ios sociales rápidos 33.3% (1) 22.2% (2) 14.3% (1) 33.3% (3) 22.7% (5) 24.0%

o 33.3% (1) 44.4% (4) 42.9% (3) 22.2% (2) 68.2% (15) 50.0%

s 0.0% (0) 33.3% (3) 42.9% (3) 0.0% (0) 0.0% (0) 12.0%

s Sociales 33.3% (1) 0.0% (0) 0.0% (0) 44.4% (4) 9.1% (2) 14.0%
Respuestas%>%
tabyl(cosas_que_afectan_tu_salud,Acciones_de_calma,show_na=F)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

_tu_salud Dibujar Distanciarse Escuchar Musica Hacer caso omiso Leer Ninguna de las anteriore

ápidos 50.0% (2) 0.0% (0) 19.2% (5) 0.0% (0) 66.7% (4) 25.0% (1)

0.0% (0) 83.3% (5) 53.8% (14) 50.0% (2) 33.3% (2) 50.0% (2)

0.0% (0) 16.7% (1) 11.5% (3) 25.0% (1) 0.0% (0) 25.0% (1)

50.0% (2) 0.0% (0) 15.4% (4) 25.0% (1) 0.0% (0) 0.0% (0)
Respuestas%>%

tabyl(cosas_que_afectan_tu_salud,afectacion_por_parte_de_padres,show_na=F
)%>%
adorn_totals("col")%>%
adorn_percentages("col")%>%
adorn_pct_formatting()%>%
adorn_ns()%>%flextable()%>% autofit()

cosas_que_afectan_tu_salud no si Total

Cambios sociales rápidos 28.0% (7) 20.0% (5) 24.0% (12)

Estudio 48.0% (12) 52.0% (13) 50.0% (25)

Padres 0.0% (0) 24.0% (6) 12.0% (6)

Redes Sociales 24.0% (6) 4.0% (1) 14.0% (7)

También podría gustarte