library(readxl)
EncuestaOrigenDestino <- read_excel("C:/Users/ACER/Desktop/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`
View(EncuestaOrigenDestino)
summary( EncuestaOrigenDestino)
## FECHA ID ESTACIÓN ESTACIÓN
## Min. :2015-05-04 00:00:00 Min. : 1.0 Length:35054
## 1st Qu.:2015-05-25 00:00:00 1st Qu.: 9.0 Class :character
## Median :2015-05-28 00:00:00 Median :14.0 Mode :character
## Mean :2015-05-28 16:56:47 Mean :14.7
## 3rd Qu.:2015-06-03 00:00:00 3rd Qu.:22.0
## Max. :2015-06-09 00:00:00 Max. :30.0
##
## ACCESO MOVIMIENTO Hora de Encuesta
## Length:35054 Length:35054 Min. :1899-12-31 00:00:00
## Class :character Class :character 1st Qu.:1899-12-31 07:36:00
## Mode :character Mode :character Median :1899-12-31 09:07:00
## Mean :1899-12-31 09:06:10
## 3rd Qu.:1899-12-31 10:39:00
## Max. :1899-12-31 12:29:00
##
## MUNICIPIO...7
## Length:35054
## Class :character
## Mode :character
##
##
##
##
## DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO / DIRECCIÓN...8
## Length:35054
## Class :character
## Mode :character
##
##
##
##
## Codigo Origen_SDG ¿QUE ESTABA HACIENDO EN ESE LUGAR? MUNICIPIO...11
## Length:35054 Min. : 1.000 Length:35054
## Class :character 1st Qu.: 2.000 Class :character
## Mode :character Median : 6.000 Mode :character
## Mean : 5.561
## 3rd Qu.: 6.000
## Max. :77.000
## NA's :383
## DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO / DIRECCIÓN...12
## Length:35054
## Class :character
## Mode :character
##
##
##
##
## Codigo Destino_SDG ¿QUE VA HACER A ESE LUGAR? ESTRATO EN SU VIVIENDA
## Length:35054 Min. : 1.000 Min. :1.000
## Class :character 1st Qu.: 1.000 1st Qu.:2.000
## Mode :character Median : 2.000 Median :3.000
## Mean : 4.682 Mean :2.835
## 3rd Qu.: 6.000 3rd Qu.:3.000
## Max. :77.000 Max. :6.000
## NA's :154 NA's :1231
## ¿DISPONIA DE UN VEHÍCULO PARA REALIZAR ESTE DESPLAZAMIENTO? OTRO ¿CUÁL?...17
## Min. :0.0000 Mode:logical
## 1st Qu.:0.0000 NA's:35054
## Median :0.0000
## Mean :0.2473
## 3rd Qu.:0.0000
## Max. :5.0000
## NA's :18189
## ANTES DESPUES EDAD SEXO
## Min. : 1.000 Mode:logical Min. :12.00 Min. :1.000
## 1st Qu.: 2.000 TRUE:53 1st Qu.:29.00 1st Qu.:2.000
## Median : 3.000 NA's:35001 Median :37.00 Median :2.000
## Mean : 3.778 Mean :38.02 Mean :1.795
## 3rd Qu.: 4.000 3rd Qu.:45.00 3rd Qu.:2.000
## Max. :18.000 Max. :91.00 Max. :2.000
## NA's :34919 NA's :479 NA's :731
## PERSONAS EN EL VEHÍCULO TIPO DE VEHÍCULO OTRO ¿CUÁL?...24 TIPO DE VIAJERO
## Min. : 1.000 Min. : 1.000 Mode:logical Length:35054
## 1st Qu.: 1.000 1st Qu.: 2.000 NA's:35054 Class :character
## Median : 1.000 Median : 2.000 Mode :character
## Mean : 1.677 Mean : 2.786
## 3rd Qu.: 2.000 3rd Qu.: 3.000
## Max. :76.000 Max. :77.000
## NA's :118 NA's :115
## comuna origen comuna destino Intracomuna
## Length:35054 Length:35054 Length:35054
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
##
# Instalar el paquete si aún no lo tienes: install.packages("dplyr")
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.2
##
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# Aplicar el filtro
df <- EncuestaOrigenDestino %>%
filter(MUNICIPIO...11=="CALI")
summary (df)
## FECHA ID ESTACIÓN ESTACIÓN
## Min. :2015-05-04 00:00:00 Min. : 1.00 Length:29479
## 1st Qu.:2015-05-25 00:00:00 1st Qu.:10.00 Class :character
## Median :2015-05-27 00:00:00 Median :15.00 Mode :character
## Mean :2015-05-28 09:19:27 Mean :15.42
## 3rd Qu.:2015-06-03 00:00:00 3rd Qu.:22.00
## Max. :2015-06-09 00:00:00 Max. :30.00
##
## ACCESO MOVIMIENTO Hora de Encuesta
## Length:29479 Length:29479 Min. :1899-12-31 06:00:00
## Class :character Class :character 1st Qu.:1899-12-31 07:40:00
## Mode :character Mode :character Median :1899-12-31 09:10:00
## Mean :1899-12-31 09:08:06
## 3rd Qu.:1899-12-31 10:40:00
## Max. :1899-12-31 12:29:00
##
## MUNICIPIO...7
## Length:29479
## Class :character
## Mode :character
##
##
##
##
## DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO / DIRECCIÓN...8
## Length:29479
## Class :character
## Mode :character
##
##
##
##
## Codigo Origen_SDG ¿QUE ESTABA HACIENDO EN ESE LUGAR? MUNICIPIO...11
## Length:29479 Min. : 1.000 Length:29479
## Class :character 1st Qu.: 2.000 Class :character
## Mode :character Median : 6.000 Mode :character
## Mean : 5.542
## 3rd Qu.: 6.000
## Max. :77.000
## NA's :83
## DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO / DIRECCIÓN...12
## Length:29479
## Class :character
## Mode :character
##
##
##
##
## Codigo Destino_SDG ¿QUE VA HACER A ESE LUGAR? ESTRATO EN SU VIVIENDA
## Length:29479 Min. : 1.000 Min. :1.000
## Class :character 1st Qu.: 1.000 1st Qu.:2.000
## Mode :character Median : 2.000 Median :3.000
## Mean : 4.733 Mean :2.841
## 3rd Qu.: 6.000 3rd Qu.:3.000
## Max. :77.000 Max. :6.000
## NA's :105 NA's :1028
## ¿DISPONIA DE UN VEHÍCULO PARA REALIZAR ESTE DESPLAZAMIENTO? OTRO ¿CUÁL?...17
## Min. :0.0000 Mode:logical
## 1st Qu.:0.0000 NA's:29479
## Median :0.0000
## Mean :0.2513
## 3rd Qu.:0.0000
## Max. :5.0000
## NA's :15298
## ANTES DESPUES EDAD SEXO
## Min. : 1.000 Mode:logical Min. :12 Min. :1.000
## 1st Qu.: 2.000 TRUE:45 1st Qu.:29 1st Qu.:2.000
## Median : 3.000 NA's:29434 Median :37 Median :2.000
## Mean : 3.739 Mean :38 Mean :1.791
## 3rd Qu.: 4.000 3rd Qu.:45 3rd Qu.:2.000
## Max. :18.000 Max. :91 Max. :2.000
## NA's :29364 NA's :376 NA's :599
## PERSONAS EN EL VEHÍCULO TIPO DE VEHÍCULO OTRO ¿CUÁL?...24 TIPO DE VIAJERO
## Min. : 1.000 Min. : 1.000 Mode:logical Length:29479
## 1st Qu.: 1.000 1st Qu.: 2.000 NA's:29479 Class :character
## Median : 1.000 Median : 2.000 Mode :character
## Mean : 1.682 Mean : 2.787
## 3rd Qu.: 2.000 3rd Qu.: 3.000
## Max. :76.000 Max. :77.000
## NA's :70 NA's :68
## comuna origen comuna destino Intracomuna
## Length:29479 Length:29479 Length:29479
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
##
Se filtran los datos para solo la ciudad de Cali, la cual es el objetivo de estudio.
colnames(df)
## [1] "FECHA"
## [2] "ID ESTACIÓN"
## [3] "ESTACIÓN"
## [4] "ACCESO"
## [5] "MOVIMIENTO"
## [6] "Hora de Encuesta"
## [7] "MUNICIPIO...7"
## [8] "DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO / DIRECCIÓN...8"
## [9] "Codigo Origen_SDG"
## [10] "¿QUE ESTABA HACIENDO EN ESE LUGAR?"
## [11] "MUNICIPIO...11"
## [12] "DEPARTAMENTO / LOCALIDAD / COMUNA / DISTRITO / BARRIO / VEREDA / HITO / DIRECCIÓN...12"
## [13] "Codigo Destino_SDG"
## [14] "¿QUE VA HACER A ESE LUGAR?"
## [15] "ESTRATO EN SU VIVIENDA"
## [16] "¿DISPONIA DE UN VEHÍCULO PARA REALIZAR ESTE DESPLAZAMIENTO?"
## [17] "OTRO ¿CUÁL?...17"
## [18] "ANTES"
## [19] "DESPUES"
## [20] "EDAD"
## [21] "SEXO"
## [22] "PERSONAS EN EL VEHÍCULO"
## [23] "TIPO DE VEHÍCULO"
## [24] "OTRO ¿CUÁL?...24"
## [25] "TIPO DE VIAJERO"
## [26] "comuna origen"
## [27] "comuna destino"
## [28] "Intracomuna"
levels(as.factor(df[["comuna origen"]]))
## [1] "0" "01" "02" "03"
## [5] "04" "05" "06" "07"
## [9] "08" "09" "10" "11"
## [13] "12" "13" "14" "15"
## [17] "16" "17" "18" "19"
## [21] "20" "21" "22" "Fuera de Cali"
# ==============================================================================
# PROYECTO: Análisis Espacial de Movilidad - Santiago de Cali
# TAREA: Generación de Mapa Coroplético desde Shapefile Comprimido (.zip)
# ==============================================================================
# 1. LIBRERÍAS -----------------------------------------------------------------
library(sf) # Geoprocesamiento
## Warning: package 'sf' was built under R version 4.5.2
## Linking to GEOS 3.13.1, GDAL 3.11.4, PROJ 9.7.0; sf_use_s2() is TRUE
library(dplyr) # Manipulación de datos
library(ggplot2) # Visualización
## Warning: package 'ggplot2' was built under R version 4.5.2
library(viridis) # Paletas térmicas
## Cargando paquete requerido: viridisLite
# 2. DEFINICIÓN DE RUTAS Y EXTRACCIÓN -----------------------------------------
ruta_zip <- "C:/Users/ACER/Downloads/mc_comunas.zip"
carpeta_destino <- "C:/Users/ACER/Downloads/mapa_cali_temp"
# Crear carpeta de destino si no existe y descomprimir
if (!dir.exists(carpeta_destino)) dir.create(carpeta_destino)
cat("Descomprimiendo archivos en:", carpeta_destino, "...\n")
## Descomprimiendo archivos en: C:/Users/ACER/Downloads/mapa_cali_temp ...
unzip(ruta_zip, exdir = carpeta_destino)
# 3. CARGA Y PREPARACIÓN DE CARTOGRAFÍA ---------------------------------------
# Leemos el archivo .shp dentro de la carpeta extraída
cat("Cargando polígonos...\n")
## Cargando polígonos...
mapa_comunas <- read_sf(file.path(carpeta_destino, "mc_comunas.shp"))
# Estandarización del ID: Convertimos a numérico para asegurar el cruce
mapa_comunas <- mapa_comunas %>%
mutate(comuna_id = as.numeric(comuna)) # Ajustar si la columna se llama distinto
# 4. LIMPIEZA DE DATOS DE ENCUESTA (df) ---------------------------------------
cat("Procesando base de datos de origen (df)...\n")
## Procesando base de datos de origen (df)...
resumen_origen <- df %>%
# Excluir datos no mapeables
filter(!`comuna origen` %in% c("0", "Fuera de Cali", NA)) %>%
# Limpieza de ceros a la izquierda ("01" -> 1)
mutate(id_numeric = as.numeric(`comuna origen`)) %>%
group_by(id_numeric) %>%
summarise(viajes = n(), .groups = "drop")
# 5. UNIÓN ESPACIAL (JOIN) ----------------------------------------------------
mapa_final <- mapa_comunas %>%
left_join(resumen_origen, by = c("comuna_id" = "id_numeric")) %>%
# Reemplazar NAs por 0 en comunas sin registros
mutate(viajes = tidyr::replace_na(viajes, 0))
# 6. VISUALIZACIÓN PROFESIONAL ------------------------------------------------
cat("Renderizando mapa...\n")
## Renderizando mapa...
mapa_final_plot <- ggplot(data = mapa_final) +
geom_sf(aes(fill = viajes), color = "white", linewidth = 0.2) +
# Etiquetas de comunas (Centroide)
geom_sf_text(aes(label = comuna_id), color = "white", size = 2.5, alpha = 0.7) +
scale_fill_viridis_c(
option = "magma",
direction = -1,
name = "Viajes Originados",
labels = scales::comma
) +
labs(
title = "Distribución Espacial de Orígenes de Viaje",
subtitle = "Santiago de Cali | Análisis por Comunas",
caption = "Fuente: Encuesta O/D y Cartografía Municipal"
) +
theme_void() +
theme(
plot.title = element_text(face = "bold", size = 16, hjust = 0.5),
plot.subtitle = element_text(size = 12, hjust = 0.5, color = "gray30"),
legend.position = "right"
)
# 7. GUARDAR Y LIMPIAR --------------------------------------------------------
print(mapa_final_plot)
ggsave("Mapa_Origenes_Cali_Final.png", plot = mapa_final_plot, width = 10, height = 8, dpi = 300)
El análisis de la distribución espacial de los orígenes de viaje en Santiago de Cali revela una marcada concentración de demanda en las comunas centrales y noroccidentales de la ciudad, particularmente en las comunas 2, 3, 5 y 19, que registran los valores más elevados de viajes originados —superiores a 2.000 viajes—, evidenciados por tonos oscuros (negro y púrpura profundo) en la escala cromática.
En contraste, las comunas del costado oriental y suroriente —como las comunas 6, 7, 13 y 14— presentan niveles intermedios de generación de viajes (entre 1.000 y 1.500), mientras que las comunas periféricas del sur, como la comuna 22, exhiben los valores más bajos de la muestra (inferiores a 500 viajes), representadas con tonalidades rosadas y salmón.
Este patrón espacial sugiere que la generación de movilidad está estrechamente relacionada con la densidad poblacional, la actividad económica y la oferta de servicios presentes en las zonas centrales, mientras que los sectores periféricos, pese a tener crecimiento urbano reciente, aún presentan una menor dinámica de desplazamientos, posiblemente asociada a déficits en accesibilidad y conectividad vial.
# ==============================================================================
# SCRIPT: VISUALIZAR MAPAS DE ORÍGENES CON NÚMEROS SIMULTÁNEAMENTE EN R
# ==============================================================================
library(sf)
library(dplyr)
library(ggplot2)
library(viridis)
library(patchwork)
# 1. CARGA DE CARTOGRAFÍA
ruta_shp <- "C:/Users/ACER/Downloads/mapa_cali_temp/mc_comunas.shp"
mapa_comunas <- read_sf(ruta_shp) %>%
mutate(comuna_id_mapa = as.numeric(comuna))
# 2. LIMPIEZA Y RECODIFICACIÓN (Origen: 1=Bici, 2=Moto, 3=Auto)
df_limpio <- df %>%
filter(!`comuna origen` %in% c("0", "Fuera de Cali", NA)) %>%
mutate(comuna_id = as.numeric(`comuna origen`)) %>%
mutate(vehiculo_texto = case_when(
as.character(`TIPO DE VEHÍCULO`) == "1" ~ "Bicicleta",
as.character(`TIPO DE VEHÍCULO`) == "2" ~ "Moto",
as.character(`TIPO DE VEHÍCULO`) == "3" ~ "Automovil",
TRUE ~ "Otro"
))
# 3. LISTA PARA ALMACENAR LOS MAPAS
vehiculos_objetivo <- c("Bicicleta", "Moto", "Automovil")
mis_mapas <- list()
# 4. BUCLE PARA CREAR LOS MAPAS CON ETIQUETAS NUMÉRICAS
for (v in vehiculos_objetivo) {
resumen_v <- df_limpio %>%
filter(vehiculo_texto == v) %>%
group_by(comuna_id) %>%
summarise(viajes = n(), .groups = "drop")
if (nrow(resumen_v) > 0) {
mapa_v <- mapa_comunas %>%
left_join(resumen_v, by = c("comuna_id_mapa" = "comuna_id")) %>%
mutate(viajes = tidyr::replace_na(viajes, 0))
# Construimos el mapa
mis_mapas[[v]] <- ggplot(data = mapa_v) +
geom_sf(aes(fill = viajes), color = "white", linewidth = 0.2) +
# --- CAPA DE NÚMEROS AÑADIDA ---
geom_sf_text(aes(label = comuna_id_mapa),
color = "white",
size = 2.8,
fontface = "bold",
alpha = 0.8) +
# -------------------------------
scale_fill_viridis_c(option = "magma", direction = -1, name = "Viajes") +
labs(title = v) +
theme_void() +
theme(
plot.title = element_text(face = "bold", hjust = 0.5),
legend.position = "bottom" # Leyenda abajo para ganar ancho
)
}
}
# 5. ENSAMBLAJE FINAL CON PATCHWORK
cat("Renderizando mapas de origen con números...\n")
## Renderizando mapas de origen con números...
mapa_final_r <- mis_mapas[["Bicicleta"]] + mis_mapas[["Moto"]] + mis_mapas[["Automovil"]] +
plot_annotation(
title = 'Santiago de Cali: Generación de Viajes por Comuna (Orígenes)',
subtitle = 'Comparativa de Bicicleta, Moto y Automóvil',
theme = theme(plot.title = element_text(size = 18, face = "bold", hjust = 0.5),
plot.subtitle = element_text(size = 14, hjust = 0.5))
)
# Mostrar en el panel de Plots
print(mapa_final_r)
La comparación simultánea de la generación de viajes en bicicleta, moto y automóvil por comuna en Santiago de Cali permite identificar patrones diferenciados de motorización y movilidad sostenible a escala intraurbana. Cada modo revela lógicas territoriales distintas que reflejan condiciones socioeconómicas, densidad urbana y nivel de acceso a infraestructura vial.
El uso de la bicicleta como modo de transporte presenta los volúmenes absolutos más bajos de los tres modos, con un máximo de 125 viajes por comuna. No obstante, su distribución espacial es reveladora: las comunas del nororiente y el centro-norte —donde se concentra la mayor densidad urbana— exhiben los valores más altos, lo que sugiere una relación entre la presencia de infraestructura ciclovial, topografía plana y distancias cortas de desplazamiento. Las comunas periféricas del sur y el oriente registran muy baja generación ciclista, posiblemente por la ausencia de red de ciclovías y mayores distancias a los destinos de trabajo y estudio.
La motocicleta es el modo motorizado individual con mayor penetración territorial en Cali. Su rango llega hasta los 900 viajes por comuna y, a diferencia de los otros modos, muestra una distribución más homogénea a lo largo del territorio, con focos de alta intensidad tanto en comunas centrales como en sectores populares del suroriente. Este patrón es consistente con el papel que cumple la moto como alternativa económica de movilidad en hogares de ingresos medios y bajos, especialmente en zonas con oferta insuficiente de transporte público. Las comunas con mayor generación de viajes en moto coinciden frecuentemente con áreas de alta densidad residencial y actividad comercial informal.
El automóvil particular exhibe el patrón espacial más selectivo de los tres modos. Las comunas del norte y noroccidente —históricamente asociadas a estratos socioeconómicos altos y medios-altos— concentran los mayores volúmenes de viajes en vehículo privado, con valores cercanos a los 750 viajes. En contraste, las comunas del suroriente y la periferia sur muestran una generación significativamente menor, lo que refleja la fuerte correlación entre tenencia vehicular e ingreso del hogar. Este comportamiento tiene implicaciones directas en la congestión vial, ya que los viajes en automóvil parten desde zonas que convergen sobre los principales corredores arteriales de la ciudad, generando cuellos de botella en horas pico.
La conclusión aborda cada modo de forma independiente y luego los integra. Los tres hallazgos más relevantes son:
Bicicleta — modo subutilizado pero con potencial claro en la zona plana del centro-norte, donde la topografía y las distancias cortas son favorables. Moto — el modo dominante en términos de cobertura territorial; su distribución homogénea en toda la ciudad la posiciona como el vehículo de acceso universal a la movilidad, especialmente en estratos bajos con déficit de transporte público. Automóvil — el modo más segregado espacialmente; su concentración en las comunas del noroccidente no es casualidad, sino un reflejo directo de la distribución del ingreso en la ciudad, con consecuencias directas en la congestión de los corredores arteriales principales. # DISTRIBUCIÓN ESPACIAL DESTINO
# ==============================================================================
# SCRIPT: MAPA DE ATRACCIÓN (DESTINOS) POR COMUNA - SANTIAGO DE CALI
# ==============================================================================
library(sf)
library(dplyr)
library(ggplot2)
library(viridis)
# 1. CARGA DE LA CARTOGRAFÍA (Usando la carpeta temporal que ya creaste)
ruta_shp <- "C:/Users/ACER/Downloads/mapa_cali_temp/mc_comunas.shp"
mapa_comunas <- read_sf(ruta_shp) %>%
mutate(comuna_id_mapa = as.numeric(comuna))
# 2. LIMPIEZA Y AGREGACIÓN DE LA ENCUESTA (Ahora enfocados en DESTINO)
cat("Procesando datos de atracción (Destinos)...\n")
## Procesando datos de atracción (Destinos)...
resumen_destino <- df %>%
# Filtrar registros nulos o viajes que terminan fuera de Cali
filter(!`comuna destino` %in% c("0", "Fuera de Cali", NA)) %>%
# Convertir el texto a número ("02" -> 2)
mutate(comuna_id = as.numeric(`comuna destino`)) %>%
# Agrupar y contar el volumen de viajes atraídos por cada comuna
group_by(comuna_id) %>%
summarise(viajes_atraidos = n(), .groups = 'drop')
# 3. CRUCE ESPACIAL (JOIN)
cat("Cruzando datos tabulares con el mapa...\n")
## Cruzando datos tabulares con el mapa...
mapa_final_destino <- mapa_comunas %>%
left_join(resumen_destino, by = c("comuna_id_mapa" = "comuna_id")) %>%
# Si a alguna comuna no llegó nadie, reemplazar el NA por 0
mutate(viajes_atraidos = tidyr::replace_na(viajes_atraidos, 0))
# 4. RENDERIZADO DEL MAPA PROFESIONAL
cat("Generando visualización de Destinos...\n")
## Generando visualización de Destinos...
mapa_destinos_plot <- ggplot(data = mapa_final_destino) +
geom_sf(aes(fill = viajes_atraidos), color = "white", linewidth = 0.2) +
geom_sf_text(aes(label = comuna_id_mapa), color = "white", size = 2.5, alpha = 0.7) +
# Usamos la opción "viridis" (verde/azul/amarillo) para diferenciarlo de los orígenes
scale_fill_viridis_c(
option = "viridis",
direction = -1,
name = "Viajes\nAtraídos",
labels = scales::comma
) +
labs(
title = "Distribución Espacial: Atracción de Viajes (Destinos)",
subtitle = "Santiago de Cali - Encuesta Origen Destino",
caption = "Fuente: Cálculos propios basados en df | Cartografía: Municipal"
) +
theme_void() +
theme(
plot.title = element_text(size = 16, face = "bold", hjust = 0.5, margin = margin(b = 5)),
plot.subtitle = element_text(size = 12, hjust = 0.5, color = "gray40", margin = margin(b = 15)),
plot.caption = element_text(size = 9, color = "gray50", hjust = 1, margin = margin(t = 15)),
legend.position = "right",
legend.title = element_text(face = "bold")
)
# 5. MOSTRAR Y GUARDAR
print(mapa_destinos_plot)
# Guardar en alta resolución
ggsave("Mapa_Destinos_Cali.png", plot = mapa_destinos_plot, width = 10, height = 8, dpi = 300, bg = "white")
cat("¡Mapa guardado exitosamente como 'Mapa_Destinos_Cali.png'!\n")
## ¡Mapa guardado exitosamente como 'Mapa_Destinos_Cali.png'!
El mapa de atracción de viajes por destino revela la estructura funcional del territorio caleño: las comunas que concentran mayor número de viajes atraídos son aquellas que albergan actividades económicas, institucionales, comerciales y de servicios de mayor escala. A diferencia del mapa de orígenes —donde la generación se asocia a la residencia—, el mapa de destinos refleja dónde trabaja, estudia y consume la ciudad.
Las comunas 2 y 3, ubicadas en el noroccidente de la ciudad, constituyen el principal nodo de atracción de viajes de toda Cali, superando los 4.000 viajes atraídos. Este comportamiento es coherente con la presencia en esta zona del centro histórico, el corredor comercial de la avenida 6ª, grandes equipamientos institucionales y sedes administrativas. Su posición como destino privilegiado implica que reciben flujos desde prácticamente todas las demás comunas, ejerciendo una presión significativa sobre los corredores viales que confluyen hacia el norte de la ciudad.
Un segundo anillo de comunas, que incluye las zonas 8, 10, 19 y 20, actúa como subcentros de actividad con capacidad de atracción media-alta. Estas comunas concentran zonas comerciales de escala barrial y zonal, clínicas, colegios y espacios de empleo terciario que generan desplazamientos desde comunas vecinas. Su distribución espacial —repartida entre el occidente y el centro de la ciudad— sugiere una estructura policéntrica incipiente, aunque todavía subordinada al polo dominante del norte.
Las comunas del suroriente y la periferia sur muestran los niveles más bajos de atracción de viajes. Estos sectores tienen un carácter predominantemente residencial, con escasa presencia de empleos formales, comercio de gran escala o equipamientos de alta jerarquía. Como resultado, sus residentes deben desplazarse largas distancias hacia los polos de atracción del norte y el centro, lo que incrementa los tiempos de viaje, la dependencia del transporte público y la huella de movilidad per cápita. La comuna 22, en el extremo sur, registra los valores más bajos, consistente con su desarrollo urbano reciente y baja densidad de actividades.
# ==============================================================================
# SCRIPT: VISUALIZAR MAPAS DE DESTINO CON NÚMEROS DE COMUNA EN R
# ==============================================================================
library(sf)
library(dplyr)
library(ggplot2)
library(viridis)
library(patchwork)
# 1. CARGA DE CARTOGRAFÍA
ruta_shp <- "C:/Users/ACER/Downloads/mapa_cali_temp/mc_comunas.shp"
mapa_comunas <- read_sf(ruta_shp) %>%
mutate(comuna_id_mapa = as.numeric(comuna))
# 2. LIMPIEZA Y RECODIFICACIÓN ENFOCADA EN DESTINOS
df_destino_limpio <- df %>%
filter(!`comuna destino` %in% c("0", "Fuera de Cali", NA)) %>%
mutate(comuna_id = as.numeric(`comuna destino`)) %>%
mutate(vehiculo_texto = case_when(
as.character(`TIPO DE VEHÍCULO`) == "1" ~ "Bicicleta",
as.character(`TIPO DE VEHÍCULO`) == "2" ~ "Moto",
as.character(`TIPO DE VEHÍCULO`) == "3" ~ "Automovil",
TRUE ~ "Otro"
))
# 3. LISTA PARA ALMACENAR LOS MAPAS
vehiculos_objetivo <- c("Bicicleta", "Moto", "Automovil")
mapas_destino_lista <- list()
# 4. BUCLE PARA CREAR LOS MAPAS CON NÚMEROS
for (v in vehiculos_objetivo) {
resumen_v <- df_destino_limpio %>%
filter(vehiculo_texto == v) %>%
group_by(comuna_id) %>%
summarise(viajes_atraidos = n(), .groups = "drop")
if (nrow(resumen_v) > 0) {
mapa_v <- mapa_comunas %>%
left_join(resumen_v, by = c("comuna_id_mapa" = "comuna_id")) %>%
mutate(viajes_atraidos = tidyr::replace_na(viajes_atraidos, 0))
# Construir el mapa
mapas_destino_lista[[v]] <- ggplot(data = mapa_v) +
geom_sf(aes(fill = viajes_atraidos), color = "white", linewidth = 0.2) +
# --- ESTA ES LA LÍNEA NUEVA QUE AGREGA LOS NÚMEROS ---
geom_sf_text(aes(label = comuna_id_mapa), color = "white", size = 3, fontface = "bold", alpha = 0.7) +
# -----------------------------------------------------
scale_fill_viridis_c(option = "viridis", direction = -1, name = "Viajes\nAtraídos") +
labs(title = v) +
theme_void() +
theme(
plot.title = element_text(face = "bold", hjust = 0.5),
legend.position = "bottom" # Mueve la barra de color abajo
)
}
}
# 5. ENSAMBLAJE Y VISUALIZACIÓN EN PANTALLA CON PATCHWORK
cat("Renderizando visualización con etiquetas numéricas...\n")
## Renderizando visualización con etiquetas numéricas...
mapa_final_destinos_r <- mapas_destino_lista[["Bicicleta"]] +
mapas_destino_lista[["Moto"]] +
mapas_destino_lista[["Automovil"]] +
plot_annotation(
title = 'Santiago de Cali: Atracción de Viajes por Comuna (Destinos)',
subtitle = 'Comparativa de Bicicleta, Moto y Automóvil',
theme = theme(plot.title = element_text(size = 18, face = "bold", hjust = 0.5),
plot.subtitle = element_text(size = 14, hjust = 0.5))
)
# Imprimir en la pantalla (Panel de Plots de RStudio)
print(mapa_final_destinos_r)
El análisis comparativo de los viajes atraídos por destino según modo de transporte en Santiago de Cali revela que, si bien los tres mapas comparten un patrón espacial con concentración en las comunas del norte y noroccidente, cada modo expresa una lógica de acceso al destino cualitativamente distinta, condicionada por el costo, la infraestructura disponible y el perfil socioeconómico del usuario.
La bicicleta presenta el volumen más bajo de atracción en términos absolutos, con un máximo de apenas 200 viajes atraídos por comuna. Las comunas 2, 3 y 4 del nororiente concentran los valores más altos, lo que refleja que los destinos en bicicleta se ubican preferentemente en zonas cercanas, con terreno plano y con algún nivel de infraestructura ciclovial. La escasa penetración de este modo como medio de acceso a destinos en comunas periféricas o del oriente indica que la bicicleta aún no logra competir en distancias largas ni en entornos viales hostiles, limitando su rol a desplazamientos de proximidad dentro de un radio reducido.
La moto lidera la atracción de viajes en términos de cobertura territorial: prácticamente todas las comunas registran flujos de llegada en este modo, aunque con marcada concentración en las comunas 2, 3, 9 y 19. Este patrón confirma que la moto es el modo con mayor versatilidad de acceso, capaz de conectar orígenes periféricos con destinos centrales sorteando la congestión vial. Su presencia elevada en comunas de actividad comercial e institucional sugiere que una proporción importante de los viajeros en moto se dirige a destinos laborales y de servicio, consolidándola como el principal instrumento de movilidad laboral para segmentos de ingreso medio y bajo en la ciudad.
Aunque el automóvil comparte el rango máximo con la moto (hasta 2.000 viajes atraídos), su distribución es significativamente más concentrada y socialmente segmentada. Las comunas 2, 3 y 6 —que aglutinan centros empresariales, zonas comerciales de alto consumo y equipamientos de salud y educación privada— registran la mayor atracción en vehículo particular. En contraste, comunas como la 17, 18 o 22 atraen muy pocos viajes en automóvil, lo que evidencia que los destinos accesibles en carro son principalmente aquellos con estacionamiento disponible, buena conectividad vial y actividad económica formal de mayor escala. Este patrón refuerza la relación entre infraestructura para el automóvil y localización de usos del suelo de alta jerarquía.
El dato más revelador de esta comparativa es que moto y automóvil comparten el mismo techo de atracción (~2.000 viajes) pero con distribuciones opuestas en calidad: el automóvil converge sobre destinos de alta formalidad económica (empresas, clínicas, universidades privadas), mientras la moto llega a destinos de empleo informal y comercio popular. Ambos flujos se superponen sobre los mismos corredores viales del norte, lo que explica en gran parte la congestión estructural de ese eje y el elevado índice de siniestralidad en motocicleta que caracteriza a Cali.