df_puna <- read_csv("Datos/puna_base_agregada (2).csv", locale= locale(encoding = "latin1"))
## Rows: 14717 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): region, ruta_natural, provincia_codigo, provincia_nombre, departame...
## dbl (5): indice_tiempo, establecimientos, unidades, habitaciones, plazas
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
En primer lugar queremos observar las variables que contiene nuestro dataset
colnames(df_puna)
## [1] "indice_tiempo" "region"
## [3] "ruta_natural" "provincia_codigo"
## [5] "provincia_nombre" "departamento_partido"
## [7] "localidad" "clasificacion_minturdep"
## [9] "tipo" "establecimientos"
## [11] "unidades" "habitaciones"
## [13] "plazas"
Ahora vamos a ver un lindo gráfico
df_hab_por_tipo_2022 <- df_puna %>%
filter(indice_tiempo==2022) %>%
group_by(tipo) %>%
summarise(cant_hab= sum(habitaciones)) %>%
mutate (cant_hab_por = round(cant_hab/sum(cant_hab)*100,1))
df_hab_por_tipo_2022 <- df_hab_por_tipo_2022 %>%
mutate (tipo=factor(tipo, levels=c("Hoteleros", "Parahoteleros","Otros colectivos")))
# comienzo a armar el gráfico de barras
# 3 capas, la de data, la de aes, y la geometria (tipo de grafico)
ggplot(data = df_hab_por_tipo_2022,
aes(x=tipo,
y= cant_hab))+
geom_col(aes(fill= tipo), color= "grey")+
# geom_text(aes(label=format(cant_hab, big.mark=".")),
#vjust= "inward")+
geom_text(aes(label = paste0(format(cant_hab,
big.mark = "."), "(",cant_hab_por, "%)")),
vjust= "inward")+
scale_fill_brewer(type= "qual",
palette= 4)+
labs(title = "Cantidad de habitaciones por tipo de alojamiento",
subtitle = "Argentina, año 2022",
x= "",
y="",
caption = "Fuente:Encuesta final MetA")+
theme_classic()+
theme(legend.position = "none")
## Warning in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, :
## 'big.mark' y 'decimal.mark' son ambos '.', lo cual puede ser confuso
embed_url("https://www.youtube.com/watch?v=FBNLNVCAcSs")
Este es todo el análisis por el momento