###Resultados encuesta CANADEVI
##Librerías
if(!require('pacman')) install.packages('pacman')
## Loading required package: pacman
pacman::p_load(tidyverse,dplyr,googlesheets4,kableExtra,knitr)
##URL de la encuesta
urlencuesta<-"https://docs.google.com/spreadsheets/u/1/d/10QVdDDmaTehrNkGofjFV6hq6vEMBRlNkHbcn6Mv94ME/edit#gid=716747361"
1
## [1] 1
##Leer encuesta
encuesta<-read_sheet(urlencuesta)
## Using an auto-discovered, cached token.
## To suppress this message, modify your code or options to clearly consent to the use of a cached token.
## See gargle's "Non-interactive auth" vignette for more details:
## https://gargle.r-lib.org/articles/non-interactive-auth.html
## The googlesheets4 package is using a cached token for claudiopacheco@canadevi.com.mx.
## Reading from "CopiCOVID-19 información del Sector Vivienda semana 3 (respuestas)"
## Range "Respuestas de formulario 1"
## New names:
## * `5.1` -> `5.1...13`
## * `5.2` -> `5.2...14`
## * `5.3` -> `5.3...15`
## * `5.4` -> `5.4...16`
## * `5.5` -> `5.5...17`
## * … and 7 more problems
##Entidad federativa
encuesta<-encuesta%>%
##Renombrar variables
rename(ent=4)
##Tabla de frecuencias
tabla<-encuesta%>%
group_by(ent)%>%
tally()%>%
rename(freq=n)%>%
mutate(porcentaje=freq/sum(freq)*100)%>%
mutate(porcentaje=round(porcentaje,1))
kable(tabla,
col.names = c("Entidad","Frecuencia","Porcentaje"),
caption = "Número de respuestas por estado",
padding = 2 ,
align=c("c"))
Número de respuestas por estado
|
Entidad
|
Frecuencia
|
Porcentaje
|
|
Aguascalientes
|
1
|
1.1
|
|
Baja California
|
4
|
4.3
|
|
Baja California Sur
|
1
|
1.1
|
|
Campeche
|
1
|
1.1
|
|
Chiapas
|
5
|
5.4
|
|
Chihuahua
|
2
|
2.2
|
|
Coahuila
|
4
|
4.3
|
|
Colima
|
1
|
1.1
|
|
Durango
|
6
|
6.5
|
|
Estado de México
|
2
|
2.2
|
|
Guanajuato
|
4
|
4.3
|
|
Hidalgo
|
3
|
3.2
|
|
Jalisco
|
3
|
3.2
|
|
Morelos
|
6
|
6.5
|
|
Nuevo León
|
9
|
9.7
|
|
Oaxaca
|
2
|
2.2
|
|
Puebla
|
12
|
12.9
|
|
Quintana Roo
|
3
|
3.2
|
|
San Luis Potosí
|
3
|
3.2
|
|
Sinaloa
|
5
|
5.4
|
|
Sonora
|
4
|
4.3
|
|
Tamaulipas
|
1
|
1.1
|
|
Veracruz
|
1
|
1.1
|
|
Yucatán
|
7
|
7.5
|
|
Zacatecas
|
3
|
3.2
|