Para este trabajo práctico seguiremos los siguientes pasos:
1. Cargamos librerías y datos necesarios para el ejercicio
library(tidyverse) # Paquete multiuso
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.0 v dplyr 1.0.5
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(sf) # Paquete clave para manipular datos espaciales
## Warning: package 'sf' was built under R version 4.0.5
## Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
library(leaflet) # Uno de los paquetes para
## Warning: package 'leaflet' was built under R version 4.0.5
library(dplyr)
library(ggplot2)
library(dplyr)
calles <- read_sf("callejero.shp")
st_crs(calles)
## Coordinate Reference System:
## User input: WGS 84
## wkt:
## GEOGCRS["WGS 84",
## DATUM["World Geodetic System 1984",
## ELLIPSOID["WGS 84",6378137,298.257223563,
## LENGTHUNIT["metre",1]]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["degree",0.0174532925199433]],
## CS[ellipsoidal,2],
## AXIS["latitude",north,
## ORDER[1],
## ANGLEUNIT["degree",0.0174532925199433]],
## AXIS["longitude",east,
## ORDER[2],
## ANGLEUNIT["degree",0.0174532925199433]],
## ID["EPSG",4326]]
2. Generar un DB de hoteles georreferenciados y cobertura de hospitales.La finalidad es entender que dicho alojamiento debe estar próximo a una institución hospitalaria en caso de emergencia.
usosdelsuelo_hoteles <- read_delim("https://cdn.buenosaires.gob.ar/datosabiertos/datasets/relevamiento-usos-del-suelo/relevamiento-usos-del-suelo-2017.csv",delim = ",") %>%
filter(TIPO2_16 =="HOTEL"| TIPO2_16 =="HOTEL FAMILIAR")
##
## -- Column specification --------------------------------------------------------
## cols(
## X = col_double(),
## Y = col_double(),
## SMP = col_character(),
## CALLE = col_character(),
## NUM = col_double(),
## TIPO1_16 = col_character(),
## TIPO2_16 = col_character(),
## PISOS_16 = col_double(),
## NOMBRE = col_character(),
## OBSERVACIO = col_character(),
## BARRIO = col_character(),
## COMUNA = col_double(),
## `5_DIG` = col_character(),
## `4_DIG` = col_character(),
## `3_DIG` = col_character(),
## `2_DIG` = col_character(),
## RAMA = col_character(),
## SUBRAMA = col_character(),
## SSRAMA = col_character()
## )
usosdelsuelo_hoteles <- st_as_sf(usosdelsuelo_hoteles,coords=c("X","Y"), crs=4326)
usosdelsuelo_hoteles<- st_transform(usosdelsuelo_hoteles, crs="+proj=tmerc +lat_0=-34.6297166 +lon_0=-58.4627 +k=1 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs")
hospitales <- read_delim("Data/Hospitales.csv",delim = ";")
##
## -- Column specification --------------------------------------------------------
## cols(
## .default = col_character(),
## long = col_double(),
## lat = col_double(),
## calle_altura = col_double(),
## calle_altura_2 = col_double(),
## codigo_postal = col_double(),
## camas_medicina = col_double(),
## camas_cirugía = col_double(),
## camas_pediatría = col_double(),
## camas_tocoginecología = col_double(),
## camas_urgencia = col_double(),
## camas_otra = col_double(),
## camas_totales = col_double()
## )
## i Use `spec()` for the full column specifications.
hospitales <- st_as_sf(hospitales,coords=c("long","lat"), crs=4326)
hospitales<- st_transform(hospitales, crs="+proj=tmerc +lat_0=-34.6297166 +lon_0=-58.4627 +k=1 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs")
coberturahospitales<- st_buffer(hospitales,dist = 1000)
coberturahospitales <- coberturahospitales %>% summarise(cobertura=TRUE)
coberturahospitales <- coberturahospitales%>%
st_transform(4326)
coberturahospitales <- st_transform(coberturahospitales,crs = st_crs(usosdelsuelo_hoteles))
usosdelsuelo_hoteles <- st_join(usosdelsuelo_hoteles,coberturahospitales)
usosdelsuelo_hoteles <- usosdelsuelo_hoteles %>%
mutate(cobertura=ifelse(is.na(cobertura),FALSE,cobertura))
3. Generar un DB de valores de alquiler (por m2) para departamentos.
properati <- read.csv("Data/ar_properties.csv",stringsAsFactors = FALSE, encoding = "UTF-8")
sapply(properati, class)
## id ad_type start_date end_date created_on
## "character" "character" "character" "character" "character"
## lat lon l1 l2 l3
## "numeric" "numeric" "character" "character" "character"
## l4 l5 l6 rooms bedrooms
## "character" "character" "logical" "integer" "integer"
## bathrooms surface_total surface_covered price currency
## "integer" "integer" "integer" "numeric" "character"
## price_period title description property_type operation_type
## "character" "character" "character" "character" "character"
properati <- properati%>%
filter(operation_type =="Alquiler") %>%
filter(lat !="") %>%
filter(lon !="") %>%
filter(l2== "Capital Federal") %>%
filter(l3 !="") %>%
filter(currency == "ARS") %>%
filter(property_type== "Departamento") %>%
filter(price!="") %>%
mutate(precioxm2=(price/surface_total)) %>%
filter(precioxm2!="")
properatipromedio <- properati %>%
group_by(l3) %>%
summarise(precioxm2 = mean(precioxm2)) %>%
rename("BARRIO"="l3")
head(properatipromedio)
## # A tibble: 6 x 2
## BARRIO precioxm2
## <chr> <dbl>
## 1 Abasto 373.
## 2 Agronomía 377.
## 3 Almagro 396.
## 4 Balvanera 375.
## 5 Barracas 345.
## 6 Barrio Norte 453.
properatipromedio1 <- data.frame(lapply(properatipromedio, function(v) {
if (is.character(v)) return(toupper(v))
else return(v)
}))
head(properatipromedio1)
## BARRIO precioxm2
## 1 ABASTO 372.6000
## 2 AGRONOMÍA 377.0118
## 3 ALMAGRO 395.7152
## 4 BALVANERA 374.5204
## 5 BARRACAS 344.6387
## 6 BARRIO NORTE 453.2799
properatipromedio2 <- properatipromedio1 %>%
select(precioxm2)
properatipromedio3 <-
iconv( properatipromedio1$BARRIO,from="UTF-8",to = "ASCII//TRANSLIT", toRaw = FALSE)
head(properatipromedio3)
## [1] "ABASTO" "AGRONOMIA" "ALMAGRO" "BALVANERA" "BARRACAS"
## [6] "BARRIO NORTE"
properatipromedio <- data.frame(c(properatipromedio3), (properatipromedio2)) %>%
rename("BARRIO"="c.properatipromedio3.")
(properatipromedio)
## BARRIO precioxm2
## 1 ABASTO 372.6000
## 2 AGRONOMIA 377.0118
## 3 ALMAGRO 395.7152
## 4 BALVANERA 374.5204
## 5 BARRACAS 344.6387
## 6 BARRIO NORTE 453.2799
## 7 BELGRANO 478.0480
## 8 BOCA 331.9151
## 9 BOEDO 360.2447
## 10 CABALLITO 393.0037
## 11 CATALINAS 1435.8963
## 12 CENTRO / MICROCENTRO 391.5347
## 13 CHACARITA 431.7847
## 14 COGHLAN 427.6095
## 15 COLEGIALES 437.1701
## 16 CONGRESO 355.4779
## 17 CONSTITUCION 331.2803
## 18 FLORES 339.1374
## 19 FLORESTA 326.4884
## 20 LAS CANITAS 538.6672
## 21 LINIERS 310.0480
## 22 MATADEROS 300.0486
## 23 MONSERRAT 407.1349
## 24 MONTE CASTRO 318.0901
## 25 NUNEZ 483.1958
## 26 ONCE 326.5867
## 27 PALERMO 532.0674
## 28 PARQUE AVELLANEDA 286.6917
## 29 PARQUE CENTENARIO 353.3284
## 30 PARQUE CHACABUCO 363.5378
## 31 PARQUE CHAS 361.2310
## 32 PARQUE PATRICIOS 343.1917
## 33 PATERNAL 380.3924
## 34 POMPEYA 317.6264
## 35 PUERTO MADERO 841.9658
## 36 RECOLETA 484.1455
## 37 RETIRO 476.2466
## 38 SAAVEDRA 402.6897
## 39 SAN CRISTOBAL 357.8630
## 40 SAN NICOLAS 372.3535
## 41 SAN TELMO 420.4523
## 42 TRIBUNALES 374.4494
## 43 VELEZ SARSFIELD 360.4770
## 44 VERSALLES 305.8189
## 45 VILLA CRESPO 420.1704
## 46 VILLA DEL PARQUE 346.7504
## 47 VILLA DEVOTO 370.8014
## 48 VILLA GENERAL MITRE 337.4903
## 49 VILLA LUGANO 264.2313
## 50 VILLA LURO 324.4564
## 51 VILLA ORTUZAR 396.6579
## 52 VILLA PUEYRREDON 367.3940
## 53 VILLA REAL 344.8679
## 54 VILLA RIACHUELO 237.9310
## 55 VILLA SANTA RITA 348.6143
## 56 VILLA SOLDATI 290.2773
## 57 VILLA URQUIZA 411.4161
properatipromedio[properatipromedio == "MONSERRAT"] <- "MONTSERRAT"
properatipromedio[properatipromedio == "NUNEZ"] <- "NUÑEZ"
properatipromedio[properatipromedio == "VILLA GENERAL MITRE"] <- "VILLA GRAL. MITRE"
(properatipromedio)
## BARRIO precioxm2
## 1 ABASTO 372.6000
## 2 AGRONOMIA 377.0118
## 3 ALMAGRO 395.7152
## 4 BALVANERA 374.5204
## 5 BARRACAS 344.6387
## 6 BARRIO NORTE 453.2799
## 7 BELGRANO 478.0480
## 8 BOCA 331.9151
## 9 BOEDO 360.2447
## 10 CABALLITO 393.0037
## 11 CATALINAS 1435.8963
## 12 CENTRO / MICROCENTRO 391.5347
## 13 CHACARITA 431.7847
## 14 COGHLAN 427.6095
## 15 COLEGIALES 437.1701
## 16 CONGRESO 355.4779
## 17 CONSTITUCION 331.2803
## 18 FLORES 339.1374
## 19 FLORESTA 326.4884
## 20 LAS CANITAS 538.6672
## 21 LINIERS 310.0480
## 22 MATADEROS 300.0486
## 23 MONTSERRAT 407.1349
## 24 MONTE CASTRO 318.0901
## 25 NUÑEZ 483.1958
## 26 ONCE 326.5867
## 27 PALERMO 532.0674
## 28 PARQUE AVELLANEDA 286.6917
## 29 PARQUE CENTENARIO 353.3284
## 30 PARQUE CHACABUCO 363.5378
## 31 PARQUE CHAS 361.2310
## 32 PARQUE PATRICIOS 343.1917
## 33 PATERNAL 380.3924
## 34 POMPEYA 317.6264
## 35 PUERTO MADERO 841.9658
## 36 RECOLETA 484.1455
## 37 RETIRO 476.2466
## 38 SAAVEDRA 402.6897
## 39 SAN CRISTOBAL 357.8630
## 40 SAN NICOLAS 372.3535
## 41 SAN TELMO 420.4523
## 42 TRIBUNALES 374.4494
## 43 VELEZ SARSFIELD 360.4770
## 44 VERSALLES 305.8189
## 45 VILLA CRESPO 420.1704
## 46 VILLA DEL PARQUE 346.7504
## 47 VILLA DEVOTO 370.8014
## 48 VILLA GRAL. MITRE 337.4903
## 49 VILLA LUGANO 264.2313
## 50 VILLA LURO 324.4564
## 51 VILLA ORTUZAR 396.6579
## 52 VILLA PUEYRREDON 367.3940
## 53 VILLA REAL 344.8679
## 54 VILLA RIACHUELO 237.9310
## 55 VILLA SANTA RITA 348.6143
## 56 VILLA SOLDATI 290.2773
## 57 VILLA URQUIZA 411.4161
4. Generamos un DB en el que unimos los dos DB anteriores: hoteles georreferenciados y cobertura de hospitales y valor por m2 de alquileres, asignando de esta manera el valor de precioxm2 a cada hotel.
alojamientosconprecio <- left_join(usosdelsuelo_hoteles, properatipromedio, by = "BARRIO")
head(alojamientosconprecio)
## Simple feature collection with 6 features and 19 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: 100834.4 ymin: 104264.2 xmax: 101567.4 ymax: 105403.1
## CRS: +proj=tmerc +lat_0=-34.6297166 +lon_0=-58.4627 +k=1 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs
## # A tibble: 6 x 20
## SMP CALLE NUM TIPO1_16 TIPO2_16 PISOS_16 NOMBRE OBSERVACIO BARRIO COMUNA
## <chr> <chr> <dbl> <chr> <chr> <dbl> <chr> <chr> <chr> <dbl>
## 1 049-1~ OLLER~ 4186 EDU HOTEL 11 <NA> <NA> CHACA~ 15
## 2 033-0~ FITZ ~ 774 EDU HOTEL 2 <NA> <NA> CHACA~ 15
## 3 033-0~ CORDO~ 6372 EDU HOTEL 3 <NA> <NA> CHACA~ 15
## 4 033-0~ ALVAR~ 318 EDU HOTEL 1 <NA> <NA> CHACA~ 15
## 5 033-0~ MAURE 3532 EDU HOTEL 3 <NA> <NA> CHACA~ 15
## 6 037-0~ GARCI~ 3570 EDU HOTEL 1 <NA> <NA> CHACA~ 15
## # ... with 10 more variables: 5_DIG <chr>, 4_DIG <chr>, 3_DIG <chr>,
## # 2_DIG <chr>, RAMA <chr>, SUBRAMA <chr>, SSRAMA <chr>, geometry <POINT [m]>,
## # cobertura <lgl>, precioxm2 <dbl>
5. Aplicamos al dataset de análisis los criterios de “accesibilidad”
5.1. Avenidas
avenidas <- calles %>% filter(tipo_c == "AVENIDA")
avenidas <- st_transform(avenidas,crs = st_crs(usosdelsuelo_hoteles))
distanciaavenidaalojamientoprecio <- st_distance(alojamientosconprecio ,avenidas)
dim(distanciaavenidaalojamientoprecio)
## [1] 1570 6758
distanciaavenidamasalojamientoprecio<- apply(distanciaavenidaalojamientoprecio,1,function(x) min(x))
distanciaavenidamasalojamientoprecio <- round(distanciaavenidamasalojamientoprecio,0)
alojamientosconprecio<- alojamientosconprecio %>% mutate(distanciaavenidaalojamientoprecio =distanciaavenidamasalojamientoprecio)
5.2. Estaciones de subte
estaciones <- read_sf("Data/estaciones_subte.shp")
estaciones <- st_transform(estaciones,crs = st_crs(usosdelsuelo_hoteles))
distancia_estacion <- st_distance(alojamientosconprecio,estaciones)
dim(distancia_estacion)
## [1] 1570 83
distancia_estacion <- apply(distancia_estacion,1,function(x) min(x))
distancia_estacion <- round(distancia_estacion,0)
alojamientosconprecio<- alojamientosconprecio %>%mutate(dist.est =distancia_estacion)
6. Aplicamos al dataset e de análisis la variable de “densidad poblacional”
radiosCensales <- read_sf("caba_radios_censales.geojson")
glimpse(radiosCensales)
## Rows: 3,554
## Columns: 9
## $ RADIO_ID <chr> "1_1_1", "1_12_1", "1_12_10", "1_12_11", "1_12_2", "1_12_3~
## $ BARRIO <chr> "RETIRO", "SAN NICOLAS", "SAN NICOLAS", "SAN NICOLAS", "SA~
## $ COMUNA <chr> "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"~
## $ POBLACION <dbl> 336, 341, 296, 528, 229, 723, 393, 600, 472, 786, 329, 135~
## $ VIVIENDAS <dbl> 82, 365, 629, 375, 445, 744, 341, 505, 504, 546, 275, 895,~
## $ HOGARES <dbl> 65, 116, 101, 136, 129, 314, 209, 275, 202, 347, 129, 342,~
## $ HOGARES_NBI <dbl> 19, 25, 1, 7, 16, 104, 110, 32, 49, 89, 15, 57, 1, 1, 2, 2~
## $ AREA_KM2 <dbl> 1.79899705, 0.01856469, 0.04438025, 0.36634000, 0.01836301~
## $ geometry <MULTIPOLYGON [°]> MULTIPOLYGON (((-58.37189 -..., MULTIPOLYGON ~
radiosCensales<- st_transform(radiosCensales,crs = st_crs(usosdelsuelo_hoteles))
st_crs(radiosCensales)
## Coordinate Reference System:
## User input: +proj=tmerc +lat_0=-34.6297166 +lon_0=-58.4627 +k=1 +x_0=100000 +y_0=100000 +ellps=intl +units=m +no_defs
## wkt:
## PROJCRS["unknown",
## BASEGEOGCRS["unknown",
## DATUM["Unknown based on International 1909 (Hayford) ellipsoid",
## ELLIPSOID["International 1909 (Hayford)",6378388,297,
## LENGTHUNIT["metre",1,
## ID["EPSG",9001]]]],
## PRIMEM["Greenwich",0,
## ANGLEUNIT["degree",0.0174532925199433],
## ID["EPSG",8901]]],
## CONVERSION["unknown",
## METHOD["Transverse Mercator",
## ID["EPSG",9807]],
## PARAMETER["Latitude of natural origin",-34.6297166,
## ANGLEUNIT["degree",0.0174532925199433],
## ID["EPSG",8801]],
## PARAMETER["Longitude of natural origin",-58.4627,
## ANGLEUNIT["degree",0.0174532925199433],
## ID["EPSG",8802]],
## PARAMETER["Scale factor at natural origin",1,
## SCALEUNIT["unity",1],
## ID["EPSG",8805]],
## PARAMETER["False easting",100000,
## LENGTHUNIT["metre",1],
## ID["EPSG",8806]],
## PARAMETER["False northing",100000,
## LENGTHUNIT["metre",1],
## ID["EPSG",8807]]],
## CS[Cartesian,2],
## AXIS["(E)",east,
## ORDER[1],
## LENGTHUNIT["metre",1,
## ID["EPSG",9001]]],
## AXIS["(N)",north,
## ORDER[2],
## LENGTHUNIT["metre",1,
## ID["EPSG",9001]]]]
radiosCensales <- radiosCensales %>% mutate(densidadPob=POBLACION/AREA_KM2)
alojamientosconprecio <- st_join(alojamientosconprecio ,radiosCensales)
7. Generamos el dataframe final
alojamientosconprecio<- alojamientosconprecio %>%
as.data.frame() %>%
select(NOMBRE,TIPO2_16, CALLE, NUM,precioxm2,distanciaavenidaalojamientoprecio,densidadPob,HOGARES_NBI,cobertura,SMP, dist.est )
alojamientosfinal <- left_join(usosdelsuelo_hoteles,alojamientosconprecio,by="SMP")
alojamientosfinal <-distinct( alojamientosfinal,SMP, .keep_all= TRUE)
quiebres <- c(0,0.2,0.4,0.6,0.8,1)
alojamientosfinal <- alojamientosfinal %>%
mutate(cat_densidad=cut(densidadPob,breaks = quantile(densidadPob,quiebres,na.rm = TRUE ),include.lowest = TRUE),
cat_NBI=cut(HOGARES_NBI,breaks = quantile(HOGARES_NBI,quiebres,na.rm = TRUE ),include.lowest = TRUE),
cat_distanciaAv=cut(-distanciaavenidaalojamientoprecio,breaks = quantile(-distanciaavenidaalojamientoprecio,quiebres,na.rm = TRUE ),include.lowest = TRUE),
cat_precioxm2=cut(-precioxm2,breaks = quantile(-precioxm2,quiebres,na.rm = TRUE ),include.lowest = TRUE),
cat_distanciaEst=cut(-dist.est,breaks = quantile(-dist.est,quiebres,na.rm = TRUE ),include.lowest = TRUE))
alojamientosfinal <- alojamientosfinal %>%
mutate(cat_densidad=as.numeric(cat_densidad),
cat_NBI=as.numeric(cat_NBI),
cat_distanciaAv=as.numeric(cat_distanciaAv),
cat_cobertura=as.numeric(cobertura.y),
cat_precioxm2=as.numeric(cat_precioxm2),
cat_distanciaEst=as.numeric(cat_distanciaEst))
8. Creamos un indicador.
alojamientosfinal<- alojamientosfinal%>%
mutate(IDS=cat_densidad*0.1+cat_NBI*0.1+cat_distanciaAv*0.2+cat_cobertura*0.3+cat_precioxm2*0.1+ cat_distanciaEst*0.2)
barrios <- radiosCensales %>% group_by(BARRIO) %>% summarise(n())
9. Generamos mapas
ggplot() +
geom_sf(data=barrios) +
geom_sf(data=alojamientosfinal %>% filter(!is.na(IDS)) , aes(color = IDS), alpha = 0.5, size=1) +
scale_color_viridis_c() +
guides(fill=FALSE) +
theme_void() +
labs(title="Oferta de hospedajes",
subtitle="Ponderancia para el alquiler de hospedajes",
caption = "Fuente: BA DATA y Properati",
color = "Ponderación")
alojamientosfinal<- st_transform(alojamientosfinal, crs = st_crs(4326))
paleta <- colorNumeric(
palette = "viridis",
domain = alojamientosfinal$IDS)
leaflet(alojamientosfinal) %>%
addTiles() %>%
addCircleMarkers(radius = ~cat_precioxm2,
popup = paste0( "<b>", "Nombre: ", "</b>",as.character(alojamientosfinal$NOMBRE.x),"<br>",
"<b>", "Dirección: ", "</b>",as.character(alojamientosfinal$CALLE.x),
"<b>", " ", "</b>",as.numeric(alojamientosfinal$NUM.x) ) ,
color = ~paleta(IDS)) %>%
addLegend(title = "Ponderación", pal = paleta, values = ~IDS)
10. Análisis del DB
ponderacion_tabla1 <- alojamientosfinal %>%
data.frame(alojamientosfinal) %>%
select(CALLE.x,NUM.x, NOMBRE.x, BARRIO, IDS) %>%
arrange(desc(IDS)) %>%
head(n=25)
ponderacion_tabla1
## CALLE.x NUM.x NOMBRE.x BARRIO IDS
## 1 ENTRE RIOS AV. 1044 NAVIA CONSTITUCION 3.6
## 2 SAN JOSE 1209 CARMEN CONSTITUCION 3.6
## 3 SAN JUAN AV. 3231 <NA> SAN CRISTOBAL 3.6
## 4 SAN JUAN AV. 844 PROVINCIAL CONSTITUCION 3.5
## 5 SAN JUAN AV. 907 AYRES DE SAN TELMO CONSTITUCION 3.5
## 6 SAN JUAN AV. 2878 SAN JUAN SAN CRISTOBAL 3.5
## 7 VARELA 66 <NA> FLORES 3.4
## 8 YERBAL 2840 <NA> FLORES 3.4
## 9 YERBAL 2850 <NA> FLORES 3.4
## 10 YERBAL 2854 <NA> FLORES 3.4
## 11 COCHABAMBA 1778 <NA> CONSTITUCION 3.4
## 12 HUMBERTO 1 1735 DEL SUR CONSTITUCION 3.4
## 13 SAN JUAN AV. 1171 <NA> CONSTITUCION 3.4
## 14 ENTRE RIOS AV. 1234 <NA> CONSTITUCION 3.4
## 15 BELGRANO 2688 O BALVANERA 3.4
## 16 SAN JUAN AV. 2083 <NA> SAN CRISTOBAL 3.4
## 17 HUMBERTO 1 3228 <NA> SAN CRISTOBAL 3.4
## 18 SAN JUAN AV. 3089 <NA> SAN CRISTOBAL 3.4
## 19 MEDRANO 97 <NA> ALMAGRO 3.3
## 20 RIVADAVIA AV. 3920 <NA> ALMAGRO 3.3
## 21 SAN JUAN AV. 814 <NA> CONSTITUCION 3.3
## 22 CONSTITUCION 1765 EL CID CONSTITUCION 3.3
## 23 GARAY, JUAN DE AV. 1277 RIO DE LA PLATA CONSTITUCION 3.3
## 24 LIMA 1169 HOSTEL SOL CONSTITUCION 3.3
## 25 SAN JUAN AV. 1253 <NA> CONSTITUCION 3.3
11. Ranking del “top 25” y representación en un mapa.
ponderacion_tabla <- alojamientosfinal %>%
select(CALLE.x,NUM.x, NOMBRE.x, BARRIO, IDS) %>%
arrange(desc(IDS)) %>%
head(n=25)
ponderacion_tabla
## Simple feature collection with 25 features and 5 fields
## Geometry type: POINT
## Dimension: XY
## Bounding box: xmin: -58.46947 ymin: -34.63028 xmax: -58.37753 ymax: -34.61003
## Geodetic CRS: WGS 84
## # A tibble: 25 x 6
## CALLE.x NUM.x NOMBRE.x BARRIO IDS geometry
## <chr> <dbl> <chr> <chr> <dbl> <POINT [°]>
## 1 ENTRE RIOS A~ 1044 NAVIA CONSTITUCION 3.6 (-58.39126 -34.62088)
## 2 SAN JOSE 1209 CARMEN CONSTITUCION 3.6 (-58.38603 -34.62263)
## 3 SAN JUAN AV. 3231 <NA> SAN CRISTOB~ 3.6 (-58.41105 -34.6246)
## 4 SAN JUAN AV. 844 PROVINCIAL CONSTITUCION 3.5 (-58.37778 -34.6224)
## 5 SAN JUAN AV. 907 AYRES DE SAN TE~ CONSTITUCION 3.5 (-58.37874 -34.62192)
## 6 SAN JUAN AV. 2878 SAN JUAN SAN CRISTOB~ 3.5 (-58.40526 -34.62448)
## 7 VARELA 66 <NA> FLORES 3.4 (-58.46482 -34.63028)
## 8 YERBAL 2840 <NA> FLORES 3.4 (-58.46929 -34.62948)
## 9 YERBAL 2850 <NA> FLORES 3.4 (-58.46939 -34.62951)
## 10 YERBAL 2854 <NA> FLORES 3.4 (-58.46947 -34.62953)
## # ... with 15 more rows
paleta2 <- colorNumeric(
palette = "viridis",
domain = ponderacion_tabla$IDS)
leaflet(ponderacion_tabla) %>%
addTiles() %>%
addCircleMarkers(popup = paste0( "<b>", "Nombre: ", "</b>",as.character(alojamientosfinal$NOMBRE.x),"<br>",
"<b>", "Dirección: ", "</b>",as.character(alojamientosfinal$CALLE.x),
"<b>", " ", "</b>",as.numeric(alojamientosfinal$NUM.x) ) ,
color = ~paleta2(IDS)) %>%
addLegend(title = "Ponderación", pal = paleta2, values = ~IDS)
12. Conclusiones