output: html_document

Caso Origen Destino Cali

Liz Gutiérrez - estudiante de maestría en Ciencia de datos

Agosto 2023

Importar librerias

require(raster)
## Loading required package: raster
## Loading required package: sp
## The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
## which was just loaded, will retire in October 2023.
## Please refer to R-spatial evolution reports for details, especially
## https://r-spatial.org/r/2023/05/15/evolution4.html.
## It may be desirable to make the sf package available;
## package maintainers should consider adding sf to Suggests:.
## The sp package is now running under evolution status 2
##      (status 2 uses the sf package in place of rgdal)
require(rgdal)
## Loading required package: rgdal
## Please note that rgdal will be retired during October 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## See https://r-spatial.org/r/2023/05/15/evolution4.html and https://github.com/r-spatial/evolution
## rgdal: version: 1.6-7, (SVN revision 1203)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.6.2, released 2023/01/02
## Path to GDAL shared files: C:/Users/ASUS/AppData/Local/R/win-library/4.3/rgdal/gdal
##  GDAL does not use iconv for recoding strings.
## GDAL binary built with GEOS: TRUE 
## Loaded PROJ runtime: Rel. 9.2.0, March 1st, 2023, [PJ_VERSION: 920]
## Path to PROJ shared files: C:/Users/ASUS/AppData/Local/R/win-library/4.3/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:2.0-0
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
require(sp)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:raster':
## 
##     intersect, select, union
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Cargue de base de datos

comunas = shapefile("C:/Users/ASUS/Desktop/Maestria Ciencia de Datos/Semestre III/Analisis inf Geografica/actividad 1/Casos/cali/Comunas.shp")
## Warning in sp::CRS(...): sf required for evolution_status==2L
plot(comunas)
## Warning in is.projected(p4str): Package sf not available

comunas
## class       : SpatialPolygonsDataFrame 
## features    : 22 
## extent      : 1053868, 1068492, 860190.2, 879441.5  (xmin, xmax, ymin, ymax)
## crs         : +proj=tmerc +lat_0=3.441883333 +lon_0=-76.5205625 +k=1 +x_0=1061900.18 +y_0=872364.63 +a=6379137 +rf=298.257222101 +units=m +no_defs 
## variables   : 4
## names       : OBJECTID, gid, comuna,   nombre 
## min values  :        1,  89,      1, Comuna 1 
## max values  :       22, 110,     22, Comuna 9
tabla=comunas@data
tabla
##    OBJECTID gid comuna    nombre
## 1         1 107      2  Comuna 2
## 2         2 108      1  Comuna 1
## 3         3 109      3  Comuna 3
## 4         4 110     19 Comuna 19
## 5         5 103     15 Comuna 15
## 6         6 104     17 Comuna 17
## 7         7 105     18 Comuna 18
## 8         8 106     22 Comuna 22
## 9         9  89      6  Comuna 6
## 10       10  90      4  Comuna 4
## 11       11  91      5  Comuna 5
## 12       12  92      7  Comuna 7
## 13       13  93      8  Comuna 8
## 14       14  94      9  Comuna 9
## 15       15  95     21 Comuna 21
## 16       16  96     13 Comuna 13
## 17       17  97     12 Comuna 12
## 18       18  98     14 Comuna 14
## 19       19  99     11 Comuna 11
## 20       20 100     10 Comuna 10
## 21       21 101     20 Comuna 20
## 22       22 102     16 Comuna 16

Prueba base de datos comunas

comuna202122=comunas[comunas$comuna>=20,]
plot(comunas)
## Warning in is.projected(p4str): Package sf not available
plot(comuna202122,col="blue",add=TRUE)

cargue base de datos Encuesta Origen destino

library(readxl)
EncuestaOrigenDestino <- read_excel("C:/Users/ASUS/Desktop/Maestria Ciencia de Datos/Semestre III/Analisis inf Geografica/actividad 1/Casos/EncuestaOrigenDestino.xlsx")
## Warning: Coercing numeric to date in A2058 / R2058C1
## Warning: Coercing numeric to date in F2058 / R2058C6
## Warning: Coercing numeric to date in A2059 / R2059C1
## Warning: Coercing numeric to date in F2059 / R2059C6
## Warning: Coercing numeric to date in A2060 / R2060C1
## Warning: Coercing numeric to date in F2060 / R2060C6
## Warning: Coercing numeric to date in A2061 / R2061C1
## Warning: Coercing numeric to date in F2061 / R2061C6
## Warning: Coercing numeric to date in A2062 / R2062C1
## Warning: Coercing numeric to date in F2062 / R2062C6
## Warning: Coercing numeric to date in A2063 / R2063C1
## Warning: Coercing numeric to date in F2063 / R2063C6
## Warning: Coercing numeric to date in A2064 / R2064C1
## Warning: Coercing numeric to date in F2064 / R2064C6
## Warning: Coercing numeric to date in A2065 / R2065C1
## Warning: Coercing numeric to date in F2065 / R2065C6
## Warning: Coercing numeric to date in A2066 / R2066C1
## Warning: Coercing numeric to date in F2066 / R2066C6
## Warning: Coercing numeric to date in A2067 / R2067C1
## Warning: Coercing numeric to date in F2067 / R2067C6
## Warning: Coercing numeric to date in A2068 / R2068C1
## Warning: Coercing numeric to date in F2068 / R2068C6
## Warning: Coercing numeric to date in A2069 / R2069C1
## Warning: Coercing numeric to date in F2069 / R2069C6
## Warning: Coercing numeric to date in A2070 / R2070C1
## Warning: Coercing numeric to date in F2070 / R2070C6
## Warning: Coercing numeric to date in A2071 / R2071C1
## Warning: Coercing numeric to date in F2071 / R2071C6
## Warning: Coercing numeric to date in A2072 / R2072C1
## Warning: Coercing numeric to date in F2072 / R2072C6
## Warning: Coercing numeric to date in A2073 / R2073C1
## Warning: Coercing numeric to date in F2073 / R2073C6
## Warning: Coercing numeric to date in A2074 / R2074C1
## Warning: Coercing numeric to date in F2074 / R2074C6
## Warning: Coercing numeric to date in A2075 / R2075C1
## Warning: Coercing numeric to date in F2075 / R2075C6
## Warning: Coercing numeric to date in A2076 / R2076C1
## Warning: Coercing numeric to date in F2076 / R2076C6
## Warning: Coercing numeric to date in A2077 / R2077C1
## Warning: Coercing numeric to date in F2077 / R2077C6
## Warning: Coercing numeric to date in A2078 / R2078C1
## Warning: Coercing numeric to date in F2078 / R2078C6
## Warning: Coercing numeric to date in A2079 / R2079C1
## Warning: Coercing numeric to date in F2079 / R2079C6
## Warning: Coercing numeric to date in A2080 / R2080C1
## Warning: Coercing numeric to date in F2080 / R2080C6
## Warning: Coercing numeric to date in A2081 / R2081C1
## Warning: Coercing numeric to date in F2081 / R2081C6
## Warning: Coercing numeric to date in A2082 / R2082C1
## Warning: Coercing numeric to date in F2082 / R2082C6
## Warning: Coercing numeric to date in A2083 / R2083C1
## Warning: Coercing numeric to date in F2083 / R2083C6
## Warning: Coercing numeric to date in A2084 / R2084C1
## Warning: Coercing numeric to date in F2084 / R2084C6
## Warning: Coercing numeric to date in A2085 / R2085C1
## Warning: Coercing numeric to date in F2085 / R2085C6
## Warning: Coercing numeric to date in A2086 / R2086C1
## Warning: Coercing numeric to date in F2086 / R2086C6
## Warning: Coercing numeric to date in A2087 / R2087C1
## Warning: Coercing numeric to date in F2087 / R2087C6
## Warning: Coercing numeric to date in A2088 / R2088C1
## Warning: Coercing numeric to date in F2088 / R2088C6
## Warning: Coercing numeric to date in A2089 / R2089C1
## Warning: Coercing numeric to date in F2089 / R2089C6
## Warning: Coercing numeric to date in A2090 / R2090C1
## Warning: Coercing numeric to date in F2090 / R2090C6
## Warning: Coercing numeric to date in A2091 / R2091C1
## Warning: Coercing numeric to date in F2091 / R2091C6
## Warning: Coercing numeric to date in A2092 / R2092C1
## Warning: Coercing numeric to date in F2092 / R2092C6
## Warning: Coercing numeric to date in A2093 / R2093C1
## Warning: Coercing numeric to date in F2093 / R2093C6
## Warning: Coercing numeric to date in A2094 / R2094C1
## Warning: Coercing numeric to date in F2094 / R2094C6
## Warning: Coercing numeric to date in A2095 / R2095C1
## Warning: Coercing numeric to date in F2095 / R2095C6
## Warning: Coercing numeric to date in A2096 / R2096C1
## Warning: Coercing numeric to date in F2096 / R2096C6
## Warning: Coercing numeric to date in A2097 / R2097C1
## Warning: Coercing numeric to date in F2097 / R2097C6
## Warning: Coercing numeric to date in A2098 / R2098C1
## Warning: Coercing numeric to date in F2098 / R2098C6
## Warning: Coercing numeric to date in A2099 / R2099C1
## Warning: Coercing numeric to date in F2099 / R2099C6
## Warning: Coercing numeric to date in A2100 / R2100C1
## Warning: Coercing numeric to date in F2100 / R2100C6
## Warning: Coercing numeric to date in A2101 / R2101C1
## Warning: Coercing numeric to date in F2101 / R2101C6
## Warning: Coercing numeric to date in A2102 / R2102C1
## Warning: Coercing numeric to date in F2102 / R2102C6
## Warning: Coercing numeric to date in A2103 / R2103C1
## Warning: Coercing numeric to date in F2103 / R2103C6
## Warning: Coercing numeric to date in A2104 / R2104C1
## Warning: Coercing numeric to date in F2104 / R2104C6
## Warning: Coercing numeric to date in A2105 / R2105C1
## Warning: Coercing numeric to date in F2105 / R2105C6
## Warning: Coercing numeric to date in A2106 / R2106C1
## Warning: Coercing numeric to date in F2106 / R2106C6
## Warning: Coercing numeric to date in A2107 / R2107C1
## Warning: Coercing numeric to date in F2107 / R2107C6
## Warning: Coercing numeric to date in A2108 / R2108C1
## Warning: Coercing numeric to date in F2108 / R2108C6
## Warning: Coercing numeric to date in A2109 / R2109C1
## Warning: Coercing numeric to date in F2109 / R2109C6
## Warning: Coercing numeric to date in A2110 / R2110C1
## Warning: Coercing numeric to date in F2110 / R2110C6
## Warning: Coercing numeric to date in A2111 / R2111C1
## Warning: Coercing numeric to date in F2111 / R2111C6
## Warning: Coercing numeric to date in A2112 / R2112C1
## Warning: Coercing numeric to date in F2112 / R2112C6
## Warning: Coercing numeric to date in A2113 / R2113C1
## Warning: Coercing numeric to date in F2113 / R2113C6
## Warning: Coercing numeric to date in A2114 / R2114C1
## Warning: Coercing numeric to date in F2114 / R2114C6
## Warning: Coercing numeric to date in A2115 / R2115C1
## Warning: Coercing numeric to date in F2115 / R2115C6
## Warning: Coercing numeric to date in A2116 / R2116C1
## Warning: Coercing numeric to date in F2116 / R2116C6
## Warning: Coercing numeric to date in A2117 / R2117C1
## Warning: Coercing numeric to date in F2117 / R2117C6
## Warning: Coercing numeric to date in A2118 / R2118C1
## Warning: Coercing numeric to date in F2118 / R2118C6
## Warning: Coercing numeric to date in A2119 / R2119C1
## Warning: Coercing numeric to date in F2119 / R2119C6
## Warning: Coercing numeric to date in A2120 / R2120C1
## Warning: Coercing numeric to date in F2120 / R2120C6
## Warning: Coercing numeric to date in A2121 / R2121C1
## Warning: Coercing numeric to date in F2121 / R2121C6
## Warning: Coercing numeric to date in A2122 / R2122C1
## Warning: Coercing numeric to date in F2122 / R2122C6
## Warning: Coercing numeric to date in A2123 / R2123C1
## Warning: Coercing numeric to date in F2123 / R2123C6
## Warning: Coercing numeric to date in A2124 / R2124C1
## Warning: Coercing numeric to date in F2124 / R2124C6
## Warning: Coercing numeric to date in A2125 / R2125C1
## Warning: Coercing numeric to date in F2125 / R2125C6
## Warning: Coercing numeric to date in A2126 / R2126C1
## Warning: Coercing numeric to date in F2126 / R2126C6
## Warning: Coercing numeric to date in A2127 / R2127C1
## Warning: Coercing numeric to date in F2127 / R2127C6
## Warning: Coercing numeric to date in A2128 / R2128C1
## Warning: Coercing numeric to date in F2128 / R2128C6
## Warning: Coercing numeric to date in A2129 / R2129C1
## Warning: Coercing numeric to date in F2129 / R2129C6
## Warning: Coercing numeric to date in A2130 / R2130C1
## Warning: Coercing numeric to date in F2130 / R2130C6
## Warning: Coercing numeric to date in A2131 / R2131C1
## Warning: Coercing numeric to date in F2131 / R2131C6
## Warning: Coercing numeric to date in A2132 / R2132C1
## Warning: Coercing numeric to date in F2132 / R2132C6
## Warning: Coercing numeric to date in A2133 / R2133C1
## Warning: Coercing numeric to date in F2133 / R2133C6
## Warning: Coercing numeric to date in A2134 / R2134C1
## Warning: Coercing numeric to date in F2134 / R2134C6
## Warning: Coercing numeric to date in A2135 / R2135C1
## Warning: Coercing numeric to date in F2135 / R2135C6
## Warning: Coercing numeric to date in A2136 / R2136C1
## Warning: Coercing numeric to date in F2136 / R2136C6
## Warning: Coercing numeric to date in A2137 / R2137C1
## Warning: Coercing numeric to date in F2137 / R2137C6
## Warning: Coercing numeric to date in A2138 / R2138C1
## Warning: Coercing numeric to date in F2138 / R2138C6
## Warning: Coercing text to numeric in J2333 / R2333C10: '1'
## Warning: Coercing text to numeric in J2334 / R2334C10: '6'
## Warning: Coercing text to numeric in J2335 / R2335C10: '11'
## Warning: Coercing text to numeric in J2336 / R2336C10: '6'
## Warning: Coercing text to numeric in J2337 / R2337C10: '6'
## Warning: Coercing text to numeric in J2338 / R2338C10: '6'
## Warning: Coercing text to numeric in J2339 / R2339C10: '6'
## Warning: Expecting logical in X3860 / R3860C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X4164 / R4164C24: got 'GRUA'
## Warning: Expecting logical in Q6623 / R6623C17: got 'BICICLETA'
## Warning: Expecting logical in X6758 / R6758C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X6900 / R6900C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X7914 / R7914C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X11168 / R11168C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X11833 / R11833C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X12398 / R12398C24: got 'VAN ESCOLAR'
## Warning: Expecting logical in Q13865 / R13865C17: got 'BUSETA'
## Warning: Expecting logical in X17913 / R17913C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X19592 / R19592C24: got 'MOTO-CARRO'
## Warning: Expecting logical in Q22244 / R22244C17: got 'BICICLETA'
## Warning: Expecting logical in X22329 / R22329C24: got 'BUS ESCOLAR'
## Warning: Expecting logical in X24019 / R24019C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X25200 / R25200C24: got 'CARRETILLA'
## Warning: Coercing text to numeric in N26235 / R26235C14: '3'
## Warning: Coercing text to numeric in J26503 / R26503C10: '6'
## Warning: Coercing text to numeric in J26935 / R26935C10: '7'
## Warning: Coercing text to numeric in J26936 / R26936C10: '6'
## Warning: Coercing text to numeric in J26937 / R26937C10: '6'
## Warning: Coercing text to numeric in J26938 / R26938C10: '1'
## Warning: Coercing text to numeric in J26939 / R26939C10: '1'
## Warning: Coercing text to numeric in J26940 / R26940C10: '6'
## Warning: Coercing text to numeric in J26941 / R26941C10: '1'
## Warning: Coercing text to numeric in J26942 / R26942C10: '6'
## Warning: Coercing text to numeric in J26943 / R26943C10: '6'
## Warning: Coercing text to numeric in J26944 / R26944C10: '1'
## Warning: Coercing text to numeric in J26945 / R26945C10: '1'
## Warning: Coercing text to numeric in J26946 / R26946C10: '1'
## Warning: Coercing text to numeric in J26947 / R26947C10: '6'
## Warning: Coercing text to numeric in J26948 / R26948C10: '8'
## Warning: Coercing text to numeric in J26949 / R26949C10: '6'
## Warning: Coercing text to numeric in J26950 / R26950C10: '1'
## Warning: Coercing text to numeric in J26951 / R26951C10: '7'
## Warning: Coercing text to numeric in J26952 / R26952C10: '6'
## Warning: Coercing text to numeric in J26953 / R26953C10: '6'
## Warning: Coercing text to numeric in J26954 / R26954C10: '6'
## Warning: Coercing text to numeric in J26955 / R26955C10: '6'
## Warning: Coercing text to numeric in J26956 / R26956C10: '6'
## Warning: Coercing text to numeric in J26957 / R26957C10: '6'
## Warning: Coercing text to numeric in J26958 / R26958C10: '6'
## Warning: Coercing text to numeric in J26959 / R26959C10: '6'
## Warning: Coercing text to numeric in J26960 / R26960C10: '6'
## Warning: Coercing text to numeric in J26961 / R26961C10: '6'
## Warning: Coercing text to numeric in J26962 / R26962C10: '6'
## Warning: Coercing text to numeric in J26963 / R26963C10: '6'
## Warning: Coercing text to numeric in J26964 / R26964C10: '6'
## Warning: Coercing text to numeric in J26965 / R26965C10: '1'
## Warning: Coercing text to numeric in J26966 / R26966C10: '1'
## Warning: Coercing text to numeric in J26967 / R26967C10: '1'
## Warning: Coercing text to numeric in J26968 / R26968C10: '1'
## Warning: Coercing text to numeric in J26969 / R26969C10: '1'
## Warning: Coercing text to numeric in J26970 / R26970C10: '1'
## Warning: Coercing text to numeric in J26971 / R26971C10: '6'
## Warning: Coercing text to numeric in J26972 / R26972C10: '6'
## Warning: Coercing text to numeric in J26973 / R26973C10: '6'
## Warning: Coercing text to numeric in J26974 / R26974C10: '6'
## Warning: Coercing text to numeric in J26975 / R26975C10: '1'
## Warning: Coercing text to numeric in J26976 / R26976C10: '1'
## Warning: Coercing text to numeric in J26977 / R26977C10: '1'
## Warning: Coercing text to numeric in J26978 / R26978C10: '6'
## Warning: Coercing text to numeric in J26979 / R26979C10: '6'
## Warning: Coercing text to numeric in J26980 / R26980C10: '6'
## Warning: Coercing text to numeric in J26981 / R26981C10: '6'
## Warning: Coercing text to numeric in J26982 / R26982C10: '6'
## Warning: Coercing text to numeric in J26983 / R26983C10: '1'
## Warning: Coercing text to numeric in J26984 / R26984C10: '1'
## Warning: Coercing text to numeric in J26985 / R26985C10: '1'
## Warning: Coercing text to numeric in J26986 / R26986C10: '6'
## Warning: Coercing text to numeric in J26987 / R26987C10: '6'
## Warning: Coercing text to numeric in J26988 / R26988C10: '6'
## Warning: Coercing text to numeric in J26989 / R26989C10: '6'
## Warning: Coercing text to numeric in J26990 / R26990C10: '1'
## Warning: Coercing text to numeric in J26991 / R26991C10: '6'
## Warning: Coercing text to numeric in J26992 / R26992C10: '1'
## Warning: Coercing text to numeric in J26993 / R26993C10: '6'
## Warning: Coercing text to numeric in J26994 / R26994C10: '6'
## Warning: Coercing text to numeric in J26995 / R26995C10: '6'
## Warning: Coercing text to numeric in J26996 / R26996C10: '6'
## Warning: Coercing text to numeric in J26997 / R26997C10: '11'
## Warning: Coercing text to numeric in J26998 / R26998C10: '6'
## Warning: Coercing text to numeric in J26999 / R26999C10: '1'
## Warning: Coercing text to numeric in J27000 / R27000C10: '6'
## Warning: Coercing text to numeric in J27001 / R27001C10: '1'
## Warning: Coercing text to numeric in J27002 / R27002C10: '6'
## Warning: Coercing text to numeric in J27003 / R27003C10: '11'
## Warning: Coercing text to numeric in J27004 / R27004C10: '6'
## Warning: Coercing text to numeric in J27005 / R27005C10: '6'
## Warning: Coercing text to numeric in J27006 / R27006C10: '6'
## Warning: Coercing text to numeric in J27007 / R27007C10: '6'
## Warning: Coercing text to numeric in J27008 / R27008C10: '6'
## Warning: Coercing text to numeric in J27009 / R27009C10: '2'
## Warning: Coercing text to numeric in J27010 / R27010C10: '6'
## Warning: Coercing text to numeric in J27011 / R27011C10: '6'
## Warning: Coercing text to numeric in J27012 / R27012C10: '11'
## Warning: Coercing text to numeric in J27013 / R27013C10: '6'
## Warning: Coercing text to numeric in J27014 / R27014C10: '1'
## Warning: Coercing text to numeric in J27015 / R27015C10: '6'
## Warning: Coercing text to numeric in J27016 / R27016C10: '6'
## Warning: Coercing text to numeric in J27017 / R27017C10: '6'
## Warning: Coercing text to numeric in J27018 / R27018C10: '6'
## Warning: Coercing text to numeric in J27019 / R27019C10: '6'
## Warning: Coercing text to numeric in J27020 / R27020C10: '6'
## Warning: Coercing text to numeric in J27021 / R27021C10: '11'
## Warning: Coercing text to numeric in J27022 / R27022C10: '6'
## Warning: Coercing text to numeric in J27023 / R27023C10: '4'
## Warning: Coercing text to numeric in J27024 / R27024C10: '6'
## Warning: Coercing text to numeric in J27025 / R27025C10: '2'
## Warning: Coercing text to numeric in J27026 / R27026C10: '2'
## Warning: Coercing text to numeric in J27027 / R27027C10: '11'
## Warning: Coercing text to numeric in J27028 / R27028C10: '2'
## Warning: Coercing text to numeric in J27029 / R27029C10: '2'
## Warning: Coercing text to numeric in J27030 / R27030C10: '2'
## Warning: Expecting logical in X31653 / R31653C24: got 'VOLQUETA'
## Warning: Expecting numeric in J31842 / R31842C10: got 'ANULADO'
## Warning: Coercing numeric to date in A33837 / R33837C1
## Warning: Coercing numeric to date in F33837 / R33837C6
## Warning: Expecting logical in X34736 / R34736C24: got 'MOTO-CARRO'
## Warning: Expecting logical in X35053 / R35053C24: got 'MOTO-CARRO'
## New names:
## • `MUNICIPIO` -> `MUNICIPIO...7`
## • `DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO /
##   DIRECCIÓN` -> `DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA
##   / HITO / DIRECCIÓN...8`
## • `MUNICIPIO` -> `MUNICIPIO...11`
## • `DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO /
##   DIRECCIÓN` -> `DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA
##   / HITO / DIRECCIÓN...12`
## • `OTRO ¿CUÁL?` -> `OTRO ¿CUÁL?...17`
## • `OTRO ¿CUÁL?` -> `OTRO ¿CUÁL?...24`

Depuaración base de datos

EncuestaOrigenDestino = EncuestaOrigenDestino [!EncuestaOrigenDestino$`comuna origen`%in%c("0","Fuera de Cali"), ]
EncuestaOrigenDestino = EncuestaOrigenDestino [!EncuestaOrigenDestino$`comuna destino`%in%c("0","Fuera de Cali"), ]

Origen = EncuestaOrigenDestino%>%group_by(`comuna origen`)%>%summarise(conteo = n())
destino = EncuestaOrigenDestino%>%group_by(`comuna destino`)%>%summarise(conteo = n())

comunas@data
##    OBJECTID gid comuna    nombre
## 1         1 107      2  Comuna 2
## 2         2 108      1  Comuna 1
## 3         3 109      3  Comuna 3
## 4         4 110     19 Comuna 19
## 5         5 103     15 Comuna 15
## 6         6 104     17 Comuna 17
## 7         7 105     18 Comuna 18
## 8         8 106     22 Comuna 22
## 9         9  89      6  Comuna 6
## 10       10  90      4  Comuna 4
## 11       11  91      5  Comuna 5
## 12       12  92      7  Comuna 7
## 13       13  93      8  Comuna 8
## 14       14  94      9  Comuna 9
## 15       15  95     21 Comuna 21
## 16       16  96     13 Comuna 13
## 17       17  97     12 Comuna 12
## 18       18  98     14 Comuna 14
## 19       19  99     11 Comuna 11
## 20       20 100     10 Comuna 10
## 21       21 101     20 Comuna 20
## 22       22 102     16 Comuna 16

convertir a numérico

Origen$`comuna origen`= as.numeric(Origen$`comuna origen`)
destino$`comuna destino`= as.numeric(destino$`comuna destino`)

Unión bases de datos y gráficos

Origen

Mapa de todos los origenes

comunas$conteo = Origen[comunas$comuna,]$conteo
spplot(comunas[,5])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo
## 1         1 107      2  Comuna 2   2250
## 2         2 108      1  Comuna 1    626
## 3         3 109      3  Comuna 3   1610
## 4         4 110     19 Comuna 19   2241
## 5         5 103     15 Comuna 15    974
## 6         6 104     17 Comuna 17   1762
## 7         7 105     18 Comuna 18   1208
## 8         8 106     22 Comuna 22    985
## 9         9  89      6  Comuna 6    797
## 10       10  90      4  Comuna 4   1193
## 11       11  91      5  Comuna 5    521
## 12       12  92      7  Comuna 7    583
## 13       13  93      8  Comuna 8    862
## 14       14  94      9  Comuna 9    737
## 15       15  95     21 Comuna 21    693
## 16       16  96     13 Comuna 13   1031
## 17       17  97     12 Comuna 12    257
## 18       18  98     14 Comuna 14    575
## 19       19  99     11 Comuna 11    717
## 20       20 100     10 Comuna 10   1094
## 21       21 101     20 Comuna 20    599
## 22       22 102     16 Comuna 16    836

Hay más personas cuyo lugar de origen son las comunas 2, 19 y 17. Esto puede relacionarse con que la mayor parte de los encuestados viven en esta zona de la ciudad, no porque contengan una mayor densidad poblacional.

Mapa origen bicicleta

Origen_bicicleta = EncuestaOrigenDestino%>% filter(`TIPO DE VEHÍCULO`==1) %>%group_by(`comuna origen`)%>%summarise(conteo = n())
Origen_bicicleta
## # A tibble: 22 × 2
##    `comuna origen` conteo
##    <chr>            <int>
##  1 01                  32
##  2 02                 122
##  3 03                  84
##  4 04                  58
##  5 05                  28
##  6 06                  29
##  7 07                  30
##  8 08                  46
##  9 09                  36
## 10 10                  71
## # ℹ 12 more rows
comunas$conteo2 = Origen_bicicleta[comunas$comuna,]$conteo
spplot(comunas[,6])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo conteo2
## 1         1 107      2  Comuna 2   2250     122
## 2         2 108      1  Comuna 1    626      32
## 3         3 109      3  Comuna 3   1610      84
## 4         4 110     19 Comuna 19   2241     113
## 5         5 103     15 Comuna 15    974      55
## 6         6 104     17 Comuna 17   1762     103
## 7         7 105     18 Comuna 18   1208      85
## 8         8 106     22 Comuna 22    985      52
## 9         9  89      6  Comuna 6    797      29
## 10       10  90      4  Comuna 4   1193      58
## 11       11  91      5  Comuna 5    521      28
## 12       12  92      7  Comuna 7    583      30
## 13       13  93      8  Comuna 8    862      46
## 14       14  94      9  Comuna 9    737      36
## 15       15  95     21 Comuna 21    693      35
## 16       16  96     13 Comuna 13   1031      62
## 17       17  97     12 Comuna 12    257      10
## 18       18  98     14 Comuna 14    575      32
## 19       19  99     11 Comuna 11    717      42
## 20       20 100     10 Comuna 10   1094      71
## 21       21 101     20 Comuna 20    599      33
## 22       22 102     16 Comuna 16    836      65

Cuando las personas se desplazan en bicicleta desde su lugar de origen, se repite el mismo patrón del anterior mapa, las comunas 2, 19 y 17 son las que presentan más registros.

Mapa origen moto

Origen_moto = EncuestaOrigenDestino%>% filter(`TIPO DE VEHÍCULO`==2) %>%group_by(`comuna origen`)%>%summarise(conteo = n())
Origen_moto
## # A tibble: 22 × 2
##    `comuna origen` conteo
##    <chr>            <int>
##  1 01                 296
##  2 02                1063
##  3 03                 702
##  4 04                 571
##  5 05                 260
##  6 06                 377
##  7 07                 272
##  8 08                 421
##  9 09                 317
## 10 10                 535
## # ℹ 12 more rows
comunas$conteo3 = Origen_moto[comunas$comuna,]$conteo
spplot(comunas[,7])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo conteo2 conteo3
## 1         1 107      2  Comuna 2   2250     122    1063
## 2         2 108      1  Comuna 1    626      32     296
## 3         3 109      3  Comuna 3   1610      84     702
## 4         4 110     19 Comuna 19   2241     113     995
## 5         5 103     15 Comuna 15    974      55     455
## 6         6 104     17 Comuna 17   1762     103     853
## 7         7 105     18 Comuna 18   1208      85     593
## 8         8 106     22 Comuna 22    985      52     430
## 9         9  89      6  Comuna 6    797      29     377
## 10       10  90      4  Comuna 4   1193      58     571
## 11       11  91      5  Comuna 5    521      28     260
## 12       12  92      7  Comuna 7    583      30     272
## 13       13  93      8  Comuna 8    862      46     421
## 14       14  94      9  Comuna 9    737      36     317
## 15       15  95     21 Comuna 21    693      35     323
## 16       16  96     13 Comuna 13   1031      62     453
## 17       17  97     12 Comuna 12    257      10     133
## 18       18  98     14 Comuna 14    575      32     258
## 19       19  99     11 Comuna 11    717      42     339
## 20       20 100     10 Comuna 10   1094      71     535
## 21       21 101     20 Comuna 20    599      33     278
## 22       22 102     16 Comuna 16    836      65     383

Cuando las personas se desplazan en moto desde su lugar de origen, se repite el mismo patrón del mapa que contiene el total de origen, las comunas 2, 19 y 17 son las que presentan más registros. Sin embargo se observa una disminución significativa en la comuna 17 respecto a bicicleta y total. .

Mapa origen automovil

Origen_automovil = EncuestaOrigenDestino%>% filter(`TIPO DE VEHÍCULO`==3) %>%group_by(`comuna origen`)%>%summarise(conteo = n())
Origen_automovil
## # A tibble: 22 × 2
##    `comuna origen` conteo
##    <chr>            <int>
##  1 01                 234
##  2 02                 860
##  3 03                 679
##  4 04                 443
##  5 05                 185
##  6 06                 314
##  7 07                 229
##  8 08                 319
##  9 09                 295
## 10 10                 404
## # ℹ 12 more rows
comunas$conteo4 = Origen_automovil[comunas$comuna,]$conteo
spplot(comunas[,8])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo conteo2 conteo3 conteo4
## 1         1 107      2  Comuna 2   2250     122    1063     860
## 2         2 108      1  Comuna 1    626      32     296     234
## 3         3 109      3  Comuna 3   1610      84     702     679
## 4         4 110     19 Comuna 19   2241     113     995     923
## 5         5 103     15 Comuna 15    974      55     455     377
## 6         6 104     17 Comuna 17   1762     103     853     662
## 7         7 105     18 Comuna 18   1208      85     593     433
## 8         8 106     22 Comuna 22    985      52     430     424
## 9         9  89      6  Comuna 6    797      29     377     314
## 10       10  90      4  Comuna 4   1193      58     571     443
## 11       11  91      5  Comuna 5    521      28     260     185
## 12       12  92      7  Comuna 7    583      30     272     229
## 13       13  93      8  Comuna 8    862      46     421     319
## 14       14  94      9  Comuna 9    737      36     317     295
## 15       15  95     21 Comuna 21    693      35     323     272
## 16       16  96     13 Comuna 13   1031      62     453     412
## 17       17  97     12 Comuna 12    257      10     133      88
## 18       18  98     14 Comuna 14    575      32     258     236
## 19       19  99     11 Comuna 11    717      42     339     268
## 20       20 100     10 Comuna 10   1094      71     535     404
## 21       21 101     20 Comuna 20    599      33     278     228
## 22       22 102     16 Comuna 16    836      65     383     320

La comuna donde más se desplazan personas en automovil desde su lugar de origen es la comuna 19, seguido de la 2, la 17 y la 3 que aparece por primera vez con el mismo rango que la 17 .

Destino

Mapa de todos los destinos

comunas$conteo5 = destino[comunas$comuna,]$conteo
spplot(comunas[,9])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo conteo2 conteo3 conteo4 conteo5
## 1         1 107      2  Comuna 2   2250     122    1063     860    3773
## 2         2 108      1  Comuna 1    626      32     296     234     187
## 3         3 109      3  Comuna 3   1610      84     702     679    2887
## 4         4 110     19 Comuna 19   2241     113     995     923    2441
## 5         5 103     15 Comuna 15    974      55     455     377     481
## 6         6 104     17 Comuna 17   1762     103     853     662    1616
## 7         7 105     18 Comuna 18   1208      85     593     433     526
## 8         8 106     22 Comuna 22    985      52     430     424    1561
## 9         9  89      6  Comuna 6    797      29     377     314     570
## 10       10  90      4  Comuna 4   1193      58     571     443    1497
## 11       11  91      5  Comuna 5    521      28     260     185     440
## 12       12  92      7  Comuna 7    583      30     272     229     598
## 13       13  93      8  Comuna 8    862      46     421     319     830
## 14       14  94      9  Comuna 9    737      36     317     295    1055
## 15       15  95     21 Comuna 21    693      35     323     272     434
## 16       16  96     13 Comuna 13   1031      62     453     412     560
## 17       17  97     12 Comuna 12    257      10     133      88     207
## 18       18  98     14 Comuna 14    575      32     258     236     316
## 19       19  99     11 Comuna 11    717      42     339     268     483
## 20       20 100     10 Comuna 10   1094      71     535     404     741
## 21       21 101     20 Comuna 20    599      33     278     228     303
## 22       22 102     16 Comuna 16    836      65     383     320     645

Los destinos a los que van más personas son las comunas 2, 3 y 19. La comuna 2 recoge una signficativa cantidad de establecimientos comerciales y entidades públicas en la ciudad, lo que puede explicar este comportamiento.

Mapa destino bicicleta

destino_bicicleta = EncuestaOrigenDestino%>% filter(`TIPO DE VEHÍCULO`==1) %>%group_by(`comuna origen`)%>%summarise(conteo = n())
destino_bicicleta
## # A tibble: 22 × 2
##    `comuna origen` conteo
##    <chr>            <int>
##  1 01                  32
##  2 02                 122
##  3 03                  84
##  4 04                  58
##  5 05                  28
##  6 06                  29
##  7 07                  30
##  8 08                  46
##  9 09                  36
## 10 10                  71
## # ℹ 12 more rows
comunas$conteo6 = destino_bicicleta[comunas$comuna,]$conteo
spplot(comunas[,10])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo conteo2 conteo3 conteo4 conteo5 conteo6
## 1         1 107      2  Comuna 2   2250     122    1063     860    3773     122
## 2         2 108      1  Comuna 1    626      32     296     234     187      32
## 3         3 109      3  Comuna 3   1610      84     702     679    2887      84
## 4         4 110     19 Comuna 19   2241     113     995     923    2441     113
## 5         5 103     15 Comuna 15    974      55     455     377     481      55
## 6         6 104     17 Comuna 17   1762     103     853     662    1616     103
## 7         7 105     18 Comuna 18   1208      85     593     433     526      85
## 8         8 106     22 Comuna 22    985      52     430     424    1561      52
## 9         9  89      6  Comuna 6    797      29     377     314     570      29
## 10       10  90      4  Comuna 4   1193      58     571     443    1497      58
## 11       11  91      5  Comuna 5    521      28     260     185     440      28
## 12       12  92      7  Comuna 7    583      30     272     229     598      30
## 13       13  93      8  Comuna 8    862      46     421     319     830      46
## 14       14  94      9  Comuna 9    737      36     317     295    1055      36
## 15       15  95     21 Comuna 21    693      35     323     272     434      35
## 16       16  96     13 Comuna 13   1031      62     453     412     560      62
## 17       17  97     12 Comuna 12    257      10     133      88     207      10
## 18       18  98     14 Comuna 14    575      32     258     236     316      32
## 19       19  99     11 Comuna 11    717      42     339     268     483      42
## 20       20 100     10 Comuna 10   1094      71     535     404     741      71
## 21       21 101     20 Comuna 20    599      33     278     228     303      33
## 22       22 102     16 Comuna 16    836      65     383     320     645      65

La comuna 2, 19 y 17 son las que en las personas en su mayoría llegan en bicicleta, esto puede explicarse porque las personas podrían sentir una mayor sensación de seguridad en la zona noroeste de la ciudad y/o las empresas del sector cuentan con facilidad de estacionamiento de bicicletas.

Mapa destino moto

destino_moto = EncuestaOrigenDestino%>% filter(`TIPO DE VEHÍCULO`==2) %>%group_by(`comuna origen`)%>%summarise(conteo = n())
destino_moto
## # A tibble: 22 × 2
##    `comuna origen` conteo
##    <chr>            <int>
##  1 01                 296
##  2 02                1063
##  3 03                 702
##  4 04                 571
##  5 05                 260
##  6 06                 377
##  7 07                 272
##  8 08                 421
##  9 09                 317
## 10 10                 535
## # ℹ 12 more rows
comunas$conteo7 = destino_moto[comunas$comuna,]$conteo
spplot(comunas[,11])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo conteo2 conteo3 conteo4 conteo5 conteo6
## 1         1 107      2  Comuna 2   2250     122    1063     860    3773     122
## 2         2 108      1  Comuna 1    626      32     296     234     187      32
## 3         3 109      3  Comuna 3   1610      84     702     679    2887      84
## 4         4 110     19 Comuna 19   2241     113     995     923    2441     113
## 5         5 103     15 Comuna 15    974      55     455     377     481      55
## 6         6 104     17 Comuna 17   1762     103     853     662    1616     103
## 7         7 105     18 Comuna 18   1208      85     593     433     526      85
## 8         8 106     22 Comuna 22    985      52     430     424    1561      52
## 9         9  89      6  Comuna 6    797      29     377     314     570      29
## 10       10  90      4  Comuna 4   1193      58     571     443    1497      58
## 11       11  91      5  Comuna 5    521      28     260     185     440      28
## 12       12  92      7  Comuna 7    583      30     272     229     598      30
## 13       13  93      8  Comuna 8    862      46     421     319     830      46
## 14       14  94      9  Comuna 9    737      36     317     295    1055      36
## 15       15  95     21 Comuna 21    693      35     323     272     434      35
## 16       16  96     13 Comuna 13   1031      62     453     412     560      62
## 17       17  97     12 Comuna 12    257      10     133      88     207      10
## 18       18  98     14 Comuna 14    575      32     258     236     316      32
## 19       19  99     11 Comuna 11    717      42     339     268     483      42
## 20       20 100     10 Comuna 10   1094      71     535     404     741      71
## 21       21 101     20 Comuna 20    599      33     278     228     303      33
## 22       22 102     16 Comuna 16    836      65     383     320     645      65
##    conteo7
## 1     1063
## 2      296
## 3      702
## 4      995
## 5      455
## 6      853
## 7      593
## 8      430
## 9      377
## 10     571
## 11     260
## 12     272
## 13     421
## 14     317
## 15     323
## 16     453
## 17     133
## 18     258
## 19     339
## 20     535
## 21     278
## 22     383

Las comunas a las que más llegan personas en moto son las 2, 19 y 17. Se repite el mismo comportamiento de los datos cuando el origen también es moto.

Mapa destino automovil

destino_automovil = EncuestaOrigenDestino%>% filter(`TIPO DE VEHÍCULO`==3) %>%group_by(`comuna origen`)%>%summarise(conteo = n())
destino_automovil
## # A tibble: 22 × 2
##    `comuna origen` conteo
##    <chr>            <int>
##  1 01                 234
##  2 02                 860
##  3 03                 679
##  4 04                 443
##  5 05                 185
##  6 06                 314
##  7 07                 229
##  8 08                 319
##  9 09                 295
## 10 10                 404
## # ℹ 12 more rows
comunas$conteo8 = destino_automovil[comunas$comuna,]$conteo
spplot(comunas[,12])
## Warning in is.projected(p4str): Package sf not available

comunas@data
##    OBJECTID gid comuna    nombre conteo conteo2 conteo3 conteo4 conteo5 conteo6
## 1         1 107      2  Comuna 2   2250     122    1063     860    3773     122
## 2         2 108      1  Comuna 1    626      32     296     234     187      32
## 3         3 109      3  Comuna 3   1610      84     702     679    2887      84
## 4         4 110     19 Comuna 19   2241     113     995     923    2441     113
## 5         5 103     15 Comuna 15    974      55     455     377     481      55
## 6         6 104     17 Comuna 17   1762     103     853     662    1616     103
## 7         7 105     18 Comuna 18   1208      85     593     433     526      85
## 8         8 106     22 Comuna 22    985      52     430     424    1561      52
## 9         9  89      6  Comuna 6    797      29     377     314     570      29
## 10       10  90      4  Comuna 4   1193      58     571     443    1497      58
## 11       11  91      5  Comuna 5    521      28     260     185     440      28
## 12       12  92      7  Comuna 7    583      30     272     229     598      30
## 13       13  93      8  Comuna 8    862      46     421     319     830      46
## 14       14  94      9  Comuna 9    737      36     317     295    1055      36
## 15       15  95     21 Comuna 21    693      35     323     272     434      35
## 16       16  96     13 Comuna 13   1031      62     453     412     560      62
## 17       17  97     12 Comuna 12    257      10     133      88     207      10
## 18       18  98     14 Comuna 14    575      32     258     236     316      32
## 19       19  99     11 Comuna 11    717      42     339     268     483      42
## 20       20 100     10 Comuna 10   1094      71     535     404     741      71
## 21       21 101     20 Comuna 20    599      33     278     228     303      33
## 22       22 102     16 Comuna 16    836      65     383     320     645      65
##    conteo7 conteo8
## 1     1063     860
## 2      296     234
## 3      702     679
## 4      995     923
## 5      455     377
## 6      853     662
## 7      593     433
## 8      430     424
## 9      377     314
## 10     571     443
## 11     260     185
## 12     272     229
## 13     421     319
## 14     317     295
## 15     323     272
## 16     453     412
## 17     133      88
## 18     258     236
## 19     339     268
## 20     535     404
## 21     278     228
## 22     383     320

Las comunas a las que más llegan las personas en automovil son las 2, 19 y 17. Se repite el mismo orden y rango que origen automovil. Lo que indica que las personas entran y salen en automovil de estas comunas lo que podría estar directamente relacionado con su nivel de ingresos ya que estas comunas tienen un estrato socioeconómico más alto.

Conclusiones

  • Las comunas que mayor cantidad de personas tienen como lugar de origen son las 2, 19 y 17 respectivamente.

  • Las comunas que más personas tienen como lugar de destino son las 2, 3 y 19. Estas agrupan una signficativa cantidad de establecimientos comerciales y entidades públicas en la ciudad, lo que puede explicar este comportamiento.

  • Las comunas donde más personas se transportan en bicicleta, tanto origen como destino es la 2, 19 y 17 respectivamente conservando la misma proporción. Lo que puede indicar que estas comunas es donde o hay mayor infraestructura vial para el transito de las bicicletas por lo que se hace mayor uso de ellas o es donde más lo demandan los caleños.

  • Las comunas donde más las personas se transportan en moto, tanto origen como destino es la 2, seguido de la 19 y la 17, conservando la misma proporción. Esto puede estar relacionado con una baja oferta de transporte público en esta zona de la ciudad.

  • Las comunas que tanto origen como destino las personas más se transportan en automovil son la 19, 2, 3 y 17 teniendo estas dos últimas el mismo rango. Podría estar relacionado con un nivel de ingresos más alto y con una baja oferta de transporte público en esta zona de la ciudad.