Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Efecto Airbnb
Efecto Airbnb Valencia
Commits
69dfc2ae
Commit
69dfc2ae
authored
Apr 06, 2019
by
numeroteca
Browse files
analiza vut valencia (distritos, barrios y tlf) y municipios en com. valenciana
parent
37c64084
Changes
7
Hide whitespace changes
Inline
Side-by-side
analysis/vut-analysis.R
View file @
69dfc2ae
# script para analizar las viviendas turísticas de la comunidad Valenciana
# Load libraries
# Load libraries
----------------------------
library
(
tidyverse
)
# for maps and theme nothing
library
(
ggmap
)
...
...
@@ -10,12 +10,12 @@ library(gsubfn)
# load data ------
vut_valenciana
<-
read.csv
(
"data/original/190302_viviendas-turisticas-comunidad-valenciana.csv"
,
stringsAsFactors
=
FALSE
)
vut_valencia
<-
read.csv
(
"data/o
riginal
/190302_viviendas-turisticas-comunidad-valenciana_valencia.csv"
,
stringsAsFactors
=
FALSE
)
vut_valencia
<-
read.csv
(
"data/o
utput
/190302_viviendas-turisticas-comunidad-valenciana_valencia
_geocoded-photon3_barrio-distrito
.csv"
,
stringsAsFactors
=
FALSE
)
vut
<-
read_csv
(
"data/output/190302_viviendas-turisticas-comunidad-valenciana_valencia_geocoded_barrio-distrito.csv"
)
#
vut <- read_csv("data/output/190302_viviendas-turisticas-comunidad-valenciana_valencia_geocoded_barrio-distrito.csv")
export.to.geocode
<-
vut
%>%
filter
(
is.na
(
barrio
))
write.csv
(
airbnb
,
file
=
"data/output/190302_viviendas-turisticas-comunidad-valenciana_valencia_por-geocodificar.csv"
,
row.names
=
FALSE
)
#
export.to.geocode <- vut %>% filter(is.na(barrio))
#
write.csv(
export.to.geocode
, file = "data/output/190302_viviendas-turisticas-comunidad-valenciana_valencia_por-geocodificar.csv", row.names = FALSE)
# shapes
barrios
<-
readOGR
(
"data/original/shapes/barrios.valencia.wgs84.geojson"
)
...
...
@@ -23,31 +23,35 @@ distritos <- readOGR("data/original/shapes/distritos.valencia.wgs84.geojson")
# municipios <- distritos
municipios
<-
readOGR
(
"data/original/shapes/municipios.provincia.valencia.geojson"
)
# Analisis comunidad valenciana -------------
# Analisis comunidad valenciana
por municipios
-------------
vut.municipio
<-
group_by
(
vut_valenciana
,
Municipio
)
%>%
summarise
(
n
=
n
()
)
%>%
arrange
(
desc
(
n
))
png
(
filename
=
"images/vut/vut-municipios-top25-comunidad-valenciana-201903.png"
,
width
=
600
,
height
=
500
)
vut.municipio
%>%
head
(
25
)
%>%
ggplot
(
aes
(
x
=
reorder
(
Municipio
,
n
),
y
=
n
))
+
scale_y_continuous
(
labels
=
function
(
x
)
format
(
x
,
big.mark
=
"."
,
scientific
=
FALSE
))
+
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"
)
labs
(
title
=
"Viviendas turísticas en registro oficial por municipo: top 25"
,
subtitle
=
"Comunidad Valenciana. Marzo 2019."
,
y
=
"Número de VUT"
,
x
=
""
,
caption
=
"Datos: Generalitat Valenciana. Gráfico: lab.montera34.com/airbnb"
)
+
geom_text
(
aes
(
label
=
format
(
n
,
big.mark
=
"."
,
scientific
=
FALSE
),
x
=
reorder
(
Municipio
,
n
),
y
=
n
+50
),
position
=
"dodge"
,
size
=
3
,
color
=
"#888888"
,
hjust
=
0
)
dev.off
()
# analisis Valencia -----------------
# names(vut) <- c("signatura","municipio","provincia","addres","tlf","lat","lon")
ggplot
(
data
=
vut
)
+
geom_bar
(
stat
=
'identity'
,
aes
(
x
=
signatura
,
y
=
tlf
))
ntlf
<-
group_by
(
vut
,
Teléfono
)
%>%
summarise
(
n
=
n
()
)
%>%
arrange
(
desc
(
n
))
# por teléfono --------------
ntlf
<-
group_by
(
vut_valencia
,
Teléfono
)
%>%
summarise
(
n
=
n
()
)
%>%
arrange
(
desc
(
n
))
png
(
filename
=
"images/vut/vut-telefonos-top25-valencia-201903.png"
,
width
=
600
,
height
=
500
)
ntlf
[
!
is.na
(
ntlf
$
Teléfono
),]
%>%
head
(
25
)
%>%
ggplot
(
aes
(
x
=
reorder
(
Teléfono
,
n
),
y
=
n
))
+
geom_col
()
+
coord_flip
()
+
...
...
@@ -59,8 +63,12 @@ theme_minimal(base_family = "Roboto Condensed", base_size = 14) +
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"
)
x
=
""
,
caption
=
"Datos: Comunidad Valenciana. Gráfico: lab.montera34.com/airbnb"
)
+
geom_text
(
aes
(
label
=
format
(
n
,
big.mark
=
"."
,
scientific
=
FALSE
),
x
=
reorder
(
Teléfono
,
n
),
y
=
n
+2
),
position
=
"dodge"
,
size
=
3
,
color
=
"#888888"
,
hjust
=
0
)
dev.off
()
# select(vut,Teléfono=="963356793")
#
...
...
@@ -69,7 +77,7 @@ theme_minimal(base_family = "Roboto Condensed", base_size = 14) +
#
# tlf=="963356793"
vut
$
Teléfono
<-
as.factor
(
vut
$
Teléfono
)
#
vut$Teléfono <- as.factor(vut$Teléfono)
# extract VUT ID --------
# vut_valencia$registro.number <- str_extract(vut_valencia$Signatura,"[:punctuation:]?[:blank:]?-\\d{5}")
...
...
@@ -135,8 +143,11 @@ ggplot() +
guides
(
colour
=
guide_legend
(
override.aes
=
list
(
size
=
3
)))
# por distrito en Valencia------------
vut.distrito
<-
group_by
(
vut
,
distrito
)
%>%
summarise
(
n
=
n
()
)
%>%
arrange
(
desc
(
n
))
vut.distrito
<-
group_by
(
vut_valencia
,
distrito
)
%>%
summarise
(
n
=
n
(),
na
)
%>%
arrange
(
desc
(
n
))
%>%
ungroup
()
vut.distrito
[
is.na
(
vut.distrito
$
distrito
),]
$
distrito
<-
"POR CLASIFICAR"
png
(
filename
=
"images/vut/vut-distritos-valencia-201903.png"
,
width
=
600
,
height
=
500
)
vut.distrito
%>%
#filter(!is.na(distrito)) %>%
ggplot
(
aes
(
x
=
reorder
(
distrito
,
n
),
y
=
n
))
+
geom_col
()
+
...
...
@@ -145,29 +156,39 @@ ggplot(aes(x = reorder(distrito,n), y = n)) +
hjust
=
0
,
size
=
3
,
color
=
"#000000"
)
+
coord_flip
()
+
theme_minimal
(
base_family
=
"Roboto Condensed"
,
base_size
=
1
0
)
+
theme_minimal
(
base_family
=
"Roboto Condensed"
,
base_size
=
1
4
)
+
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 distrito"
,
labs
(
title
=
"Número de viviendas turísticas por distrito
en registro oficial
"
,
subtitle
=
"Valencia. Marzo 2019."
,
y
=
"nº anuncios"
,
x
=
"
tlf
"
,
x
=
""
,
caption
=
"Datos: Comunidad Valenciana. Gráfico: lab.montera34.com/airbnb"
)
dev.off
()
# por barrio
# por barrio
-----------------------------
vut.barrio
<-
group_by
(
vut
,
barrio
)
%>%
summarise
(
n
=
n
()
)
%>%
arrange
(
desc
(
n
))
vut.barrio
%>%
ggplot
(
aes
(
x
=
reorder
(
barrio
,
n
),
y
=
n
))
+
vut.barrio
[
is.na
(
vut.barrio
$
barrio
),]
$
barrio
<-
"POR CLASIFICAR"
png
(
filename
=
"images/vut/vut-barrios-valencia-201903.png"
,
width
=
600
,
height
=
1100
)
vut.barrio
%>%
filter
(
!
barrio
==
"POR CLASIFICAR"
)
%>%
ggplot
(
aes
(
x
=
reorder
(
barrio
,
n
),
y
=
n
))
+
geom_col
()
+
coord_flip
()
+
theme_minimal
(
base_family
=
"Roboto Condensed"
,
base_size
=
10
)
+
geom_text
(
data
=
vut.barrio
%>%
filter
(
!
barrio
==
"POR CLASIFICAR"
),
aes
(
label
=
n
,
y
=
n
+1
),
hjust
=
0
,
size
=
3
,
color
=
"#000000"
)
+
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 barrio"
,
subtitle
=
"Valencia. Marzo 2019."
,
labs
(
title
=
"Número de viviendas turísticas por barrio
en registro oficial
"
,
subtitle
=
"Valencia. Marzo 2019.
(1.202 por clasificar).
"
,
y
=
"nº anuncios"
,
x
=
"
tlf
"
,
x
=
""
,
caption
=
"Datos: Comunidad Valenciana. Gráfico: lab.montera34.com/airbnb"
)
dev.off
()
images/vut/vut-barrios-valencia-201903.png
0 → 100644
View file @
69dfc2ae
24.9 KB
images/vut/vut-distritos-valencia-201903.png
0 → 100644
View file @
69dfc2ae
16.5 KB
images/vut/vut-municipios-top25-comunidad-valenciana-201903.png
0 → 100644
View file @
69dfc2ae
15 KB
images/vut/vut-municipios-top50-comunidad-valenciana-201903.png
0 → 100644
View file @
69dfc2ae
24.1 KB
images/vut/vut-telefonos-top25-valencia-201903.png
0 → 100644
View file @
69dfc2ae
12.8 KB
images/vut/vut-top25-barrios-valencia-201903.png
0 → 100644
View file @
69dfc2ae
23.3 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment