From 3891de6d9e1a04c28b91909fdc24148584485ed5 Mon Sep 17 00:00:00 2001 From: numeroteca Date: Sun, 3 Mar 2019 12:36:12 +0100 Subject: [PATCH] =?UTF-8?q?add=20R=20script=20for=20viviendas=20tur=C3=ADs?= =?UTF-8?q?ticas=20analisis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- analysis/vut-analysis.R | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 analysis/vut-analysis.R diff --git a/analysis/vut-analysis.R b/analysis/vut-analysis.R new file mode 100644 index 0000000..c94f363 --- /dev/null +++ b/analysis/vut-analysis.R @@ -0,0 +1,57 @@ +# script para analizar las viviendas turísticas de la comunidad Valenciana +library(tidyverse) + +# load data +vut_valencia <- read_csv("data/original/190302_viviendas-turisticas-comunidad-valenciana.csv") + +vut <- read_csv("data/original/190302_viviendas-turisticas-comunidad-valenciana_valencia.csv") + +# Analisis comunidad valenciana ------------- +vut.municipio <- group_by(vut_valencia,Municipio) %>% summarise( n= n() ) %>% arrange(desc(n)) + +vut.municipio %>% head(25) %>% + ggplot(aes(x = reorder(Municipio,n), y = n)) + + geom_col() + coord_flip() + + theme_minimal(base_family = "Roboto Condensed", base_size = 14) + + theme( + panel.grid.minor.y = element_blank(), panel.grid.major.y = element_blank(), + legend.position = "bottom" + ) + + labs(title = "Número de viviendas turísticas por municipo: top 25", + subtitle = "Valencia. Marzo 2019.", + y = "nº anuncios", + x = "tlf", + caption = "Datos: Comunidad Valenciana. Gráfico: lab.montera34.com/airbnb") + + + + +# analisis Valencia ----------------- +table(vut$Signatura) + +names(vut) <- c("signatura","municipio","provincia","addres","tlf") + +ggplot(data=vut)+ + geom_bar(stat='identity', aes(x = signatura, y = tlf)) + +ntlf<- group_by(vut,tlf) %>% summarise( n= n() ) %>% arrange(desc(n)) + +ntlf[!is.na(ntlf$tlf),] %>% head(25) %>% +ggplot(aes(x = reorder(tlf,n), y = n)) + + geom_col() + coord_flip() + +theme_minimal(base_family = "Roboto Condensed", base_size = 14) + + theme( + panel.grid.minor.y = element_blank(), panel.grid.major.y = element_blank(), + legend.position = "bottom" + ) + + labs(title = "Número de viviendas turísticas por teléfono: top 25", + subtitle = "Valencia. Marzo 2019.", + y = "nº anuncios", + x = "tlf", + caption = "Datos: Comunidad Valenciana. Gráfico: lab.montera34.com/airbnb") + +select(vut,tlf==963356793) + +table(local_activo$room_type) + + -- 2.24.1