library (tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.4 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 2.0.1 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library (sf)
## Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
universidades <- read.csv ("universidades.csv", stringsAsFactors = TRUE)
summary(universidades)
## regimen
## Público: 87
## Privado :306
##
##
##
##
##
## universida
## Universidad Argentina John F. Kennedy : 42
## Universidad de Buenos Aires : 25
## Instituto Tecnológico de Buenos Aires : 24
## Instituto Universitario de la PolicÃÂa Federal Argentina : 18
## Pontificia Universidad Católica Argentina Santa MarÃÂa de los Buenos Aires: 17
## Universidad del CEMA : 17
## (Other) :250
## univ_c unidad_aca unac_c
## Min. : 1.00 Rectorado : 38 Min. : 1.0
## 1st Qu.:15.00 Facultad de Ciencias Económicas: 8 1st Qu.: 23.0
## Median :23.00 Facultad de IngenierÃÂa : 5 Median :121.0
## Mean :24.16 Facultad de Ciencias Sociales : 4 Mean :129.7
## 3rd Qu.:34.00 Facultad de Derecho : 4 3rd Qu.:220.0
## Max. :51.00 Departamento de Investigación : 3 Max. :318.0
## (Other) :331
## anexo_c unicue cui telef
## Min. :0.000000 Min. : 100100 Min. : 185 5236-1200 : 41
## 1st Qu.:0.000000 1st Qu.:1506200 1st Qu.:2462 4349-0200 : 12
## Median :0.000000 Median :2304200 Median :2481 (C)6314-3000 : 10
## Mean :0.005089 Mean :2429251 Mean :2346 4342-7788 : 10
## 3rd Qu.:0.000000 3rd Qu.:3409500 3rd Qu.:2522 (C)5239-4000 : 8
## Max. :1.000000 Max. :5100100 Max. :2561 (C)6314û3000: 7
## (Other) :305
## fax web
## 5236-1200: 41 :316
## : 39 http://artesmusicales@iuna.edu.ar : 1
## 4342-7654: 10 http://audiovisuales.iuna.edu.ar : 1
## 6314-1654: 10 http://criticadeartes.iuna.edu.ar : 1
## 4815-3290: 9 http://dramaticas.iuna.edu.ar : 1
## 4983-2624: 9 http://formaciondocente.iuna.edu.ar: 1
## (Other) :275 (Other) : 72
## direccion_norm calle altura
## Bartolomé Mitre 1411 : 42 Bartolomé Mitre : 46 Min. : 15
## Av. Eduardo Madero 399: 24 Av. Córdoba : 27 1st Qu.: 480
## Av. Córdoba 374 : 17 Av. Eduardo Madero : 24 Median :1332
## Rosario 532 : 15 Av. Alicia Moreau de Justo : 15 Mean :1498
## Chacabuco 90 : 11 Rosario : 15 3rd Qu.:1837
## Sarmiento 2037 : 10 Av. Pte. Figueroa Alcorta : 13 Max. :7597
## (Other) :274 (Other) :253
## WKT_gkba barrio
## POINT (-58.3864416149974 -34.6075104253149): 42 San Nicolas : 81
## POINT (-58.3678488464698 -34.6031162314776): 24 Balvanera : 48
## POINT (-58.3723604181354 -34.5986727036622): 17 Monserrat : 41
## POINT (-58.4361507684532 -34.6196283863132): 15 Puerto Madero: 39
## POINT (-58.3715880886931 -34.5866795404173): 11 Palermo : 31
## POINT (-58.3762527525278 -34.6091537387281): 11 Recoleta : 27
## (Other) :273 (Other) :126
## comuna codigo_postal codigo_postal_argentino long
## Comuna 1 :192 Min. :1002 C1037ABA: 42 Min. :-58.51
## Comuna 3 : 48 1st Qu.:1044 C1106ACD: 24 1st Qu.:-58.43
## Comuna 14: 31 Median :1103 C1054AAP: 17 Median :-58.39
## Comuna 2 : 27 Mean :1173 C1424CCL: 15 Mean :-58.40
## Comuna 6 : 25 3rd Qu.:1406 C1069AAB: 11 3rd Qu.:-58.38
## Comuna 13: 19 Max. :1439 C1044AAE: 10 Max. :-58.37
## (Other) : 51 NA's :4 (Other) :274
## lat
## Min. :-34.68
## 1st Qu.:-34.61
## Median :-34.60
## Mean :-34.60
## 3rd Qu.:-34.60
## Max. :-34.54
##
ggplot ()+
geom_point (data= universidades, aes (x= long , y= lat))
test2 <- st_read ("test2.geojson")
## Reading layer `test2' from data source
## `C:\Users\HP Note\Desktop\CDDPC TP01c\test2.geojson' using driver `GeoJSON'
## Simple feature collection with 3554 features and 15 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -58.53152 ymin: -34.70529 xmax: -58.33514 ymax: -34.52755
## Geodetic CRS: WGS 84
test2 <- test2 %>%
select(-WKT)
ggplot () + geom_sf (data = test2)+
geom_point (data = universidades, aes (x = long, y = lat, color = regimen))+
labs (title =" Universidades en CABA ")+
theme_void ()
universidades_geo <- universidades %>%
st_as_sf (coords=c ("long","lat"), crs = 4326)
summary(universidades_geo)
## regimen
## Público: 87
## Privado :306
##
##
##
##
##
## universida
## Universidad Argentina John F. Kennedy : 42
## Universidad de Buenos Aires : 25
## Instituto Tecnológico de Buenos Aires : 24
## Instituto Universitario de la PolicÃÂa Federal Argentina : 18
## Pontificia Universidad Católica Argentina Santa MarÃÂa de los Buenos Aires: 17
## Universidad del CEMA : 17
## (Other) :250
## univ_c unidad_aca unac_c
## Min. : 1.00 Rectorado : 38 Min. : 1.0
## 1st Qu.:15.00 Facultad de Ciencias Económicas: 8 1st Qu.: 23.0
## Median :23.00 Facultad de IngenierÃÂa : 5 Median :121.0
## Mean :24.16 Facultad de Ciencias Sociales : 4 Mean :129.7
## 3rd Qu.:34.00 Facultad de Derecho : 4 3rd Qu.:220.0
## Max. :51.00 Departamento de Investigación : 3 Max. :318.0
## (Other) :331
## anexo_c unicue cui telef
## Min. :0.000000 Min. : 100100 Min. : 185 5236-1200 : 41
## 1st Qu.:0.000000 1st Qu.:1506200 1st Qu.:2462 4349-0200 : 12
## Median :0.000000 Median :2304200 Median :2481 (C)6314-3000 : 10
## Mean :0.005089 Mean :2429251 Mean :2346 4342-7788 : 10
## 3rd Qu.:0.000000 3rd Qu.:3409500 3rd Qu.:2522 (C)5239-4000 : 8
## Max. :1.000000 Max. :5100100 Max. :2561 (C)6314û3000: 7
## (Other) :305
## fax web
## 5236-1200: 41 :316
## : 39 http://artesmusicales@iuna.edu.ar : 1
## 4342-7654: 10 http://audiovisuales.iuna.edu.ar : 1
## 6314-1654: 10 http://criticadeartes.iuna.edu.ar : 1
## 4815-3290: 9 http://dramaticas.iuna.edu.ar : 1
## 4983-2624: 9 http://formaciondocente.iuna.edu.ar: 1
## (Other) :275 (Other) : 72
## direccion_norm calle altura
## Bartolomé Mitre 1411 : 42 Bartolomé Mitre : 46 Min. : 15
## Av. Eduardo Madero 399: 24 Av. Córdoba : 27 1st Qu.: 480
## Av. Córdoba 374 : 17 Av. Eduardo Madero : 24 Median :1332
## Rosario 532 : 15 Av. Alicia Moreau de Justo : 15 Mean :1498
## Chacabuco 90 : 11 Rosario : 15 3rd Qu.:1837
## Sarmiento 2037 : 10 Av. Pte. Figueroa Alcorta : 13 Max. :7597
## (Other) :274 (Other) :253
## WKT_gkba barrio
## POINT (-58.3864416149974 -34.6075104253149): 42 San Nicolas : 81
## POINT (-58.3678488464698 -34.6031162314776): 24 Balvanera : 48
## POINT (-58.3723604181354 -34.5986727036622): 17 Monserrat : 41
## POINT (-58.4361507684532 -34.6196283863132): 15 Puerto Madero: 39
## POINT (-58.3715880886931 -34.5866795404173): 11 Palermo : 31
## POINT (-58.3762527525278 -34.6091537387281): 11 Recoleta : 27
## (Other) :273 (Other) :126
## comuna codigo_postal codigo_postal_argentino geometry
## Comuna 1 :192 Min. :1002 C1037ABA: 42 POINT :393
## Comuna 3 : 48 1st Qu.:1044 C1106ACD: 24 epsg:4326 : 0
## Comuna 14: 31 Median :1103 C1054AAP: 17 +proj=long...: 0
## Comuna 2 : 27 Mean :1173 C1424CCL: 15
## Comuna 6 : 25 3rd Qu.:1406 C1069AAB: 11
## Comuna 13: 19 Max. :1439 C1044AAE: 10
## (Other) : 51 NA's :4 (Other) :274
ggplot () +
geom_sf (data = test2) +
geom_sf (data = universidades_geo, aes (color = comuna))+
labs (title =" Universidades por comunas en CABA ")+
theme_void ()
universidades_geo <- st_join (universidades_geo, test2)
universidades_comunas <- universidades_geo%>%
group_by (COMUNA)%>%
summarise (cantidad= n ())
universidades_comunas <- universidades_comunas %>%
st_set_geometry (NULL)
test2.agrup <- test2%>%
group_by (COMUNA)%>%
summarise (TOTAL_POB= n ())
test2 <- left_join (test2, universidades_comunas, by ="COMUNA")
ggplot ()+
geom_sf (data= test2, aes (fill= cantidad))+
labs(title = "Universidades en la Ciudad de Buenos Aires",
fill = "Universidades x Comuna",
caption= "Fuente:https://data.buenosaires.gob.ar/dataset")+
theme_void ()