Áreas de la estadística Espacial y conceptos de Cartografía

A continuación se trabajará con una base de datos de individuos que muestran diferentes comportamientos de movilidad. El objetivo de este trabajo consiste en plasmar la presencia por comunas de Cali por medio de diferentes mapas con diferentes escalas de color.

Carga de data y librerías

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.0     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(datasets)
library(dplyr)

require(raster)
## Loading required package: raster
## Loading required package: sp
## 
## Attaching package: 'raster'
## 
## The following object is masked from 'package:dplyr':
## 
##     select
require(gdalcubes)
## Loading required package: gdalcubes
## 
## Attaching package: 'gdalcubes'
## 
## The following objects are masked from 'package:raster':
## 
##     animate, crop, extent, nbands
## 
## The following object is masked from 'package:sp':
## 
##     dimensions
require(gdalraster)
## Loading required package: gdalraster
## GDAL 3.8.2, released 2023/16/12, GEOS 3.11.2, PROJ 9.3.1
## 
## Attaching package: 'gdalraster'
## 
## The following objects are masked from 'package:raster':
## 
##     calc, rasterize
## 
## The following object is masked from 'package:dplyr':
## 
##     combine
require(gdalUtilities)
## Loading required package: gdalUtilities
## 
## Attaching package: 'gdalUtilities'
## 
## The following object is masked from 'package:gdalraster':
## 
##     ogr2ogr
require(sp)
comunas <- shapefile("C:/Users/diaramos/Documents/MCD/ANALISIS INFO GEO Y ESP/Casos/cali/Comunas.shp")
tablacom=comunas@data

library(readxl)
EncuestaOrigenDestino <- read_excel("C:/Users/diaramos/Documents/MCD/ANALISIS INFO GEO Y ESP/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`

Comportamiento global de comunas de destino y origen

Comunas de origen

Debido a quer el interés del estudio se centra en las comunas de cali procedemos a filtrar para no tener en cuenta todas aquellas fuera de la ciudad. Adicionalmente, no se tiene en cuenta el número 0 ya que no hay comunas bajo este ID.

EncuestaOrigenDestino2 = EncuestaOrigenDestino %>% filter(`comuna origen` != "Fuera de Cali" & `comuna destino` != "Fuera de Cali")
EncuestaOrigenDestino2 = EncuestaOrigenDestino2 %>% filter(`comuna origen` != "0" & `comuna destino` != "0")
EncuestaOrigenDestino2$`comuna origen` = as.numeric(EncuestaOrigenDestino2$`comuna origen`)
EncuestaOrigenDestino2$`comuna destino` = as.numeric(EncuestaOrigenDestino2$`comuna destino`)

cuentacomunaorg = subset(data.frame(table(EncuestaOrigenDestino2$`comuna origen`)))
comunas@data$tablaorigen=cuentacomunaorg$Freq
comunas@data
##    OBJECTID gid comuna    nombre tablaorigen
## 1         1 107      2  Comuna 2         626
## 2         2 108      1  Comuna 1        2250
## 3         3 109      3  Comuna 3        1610
## 4         4 110     19 Comuna 19        1193
## 5         5 103     15 Comuna 15         521
## 6         6 104     17 Comuna 17         797
## 7         7 105     18 Comuna 18         583
## 8         8 106     22 Comuna 22         862
## 9         9  89      6  Comuna 6         737
## 10       10  90      4  Comuna 4        1094
## 11       11  91      5  Comuna 5         717
## 12       12  92      7  Comuna 7         257
## 13       13  93      8  Comuna 8        1031
## 14       14  94      9  Comuna 9         575
## 15       15  95     21 Comuna 21         974
## 16       16  96     13 Comuna 13         836
## 17       17  97     12 Comuna 12        1762
## 18       18  98     14 Comuna 14        1208
## 19       19  99     11 Comuna 11        2241
## 20       20 100     10 Comuna 10         599
## 21       21 101     20 Comuna 20         693
## 22       22 102     16 Comuna 16         985
etiqueta1 =paste(as.character(comunas$comuna),",",comunas$tablaorigen)
spl1 = list('sp.text', coordinates(comunas), etiqueta1, cex=.5)


plot1=spplot(comunas[,5],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.8),
             sp.layout = spl1, col='white')
par.settings = list(fontsize = list(text = 5))
plot1

Como puede observarse, las localidades número 1 y 11 son auqellas que muestran la mayor salida de personas.

Comunas de destino

cuentacomunadest = subset(data.frame(table(EncuestaOrigenDestino2$`comuna destino`)))
comunas@data$tabladest=cuentacomunadest$Freq
comunas@data
##    OBJECTID gid comuna    nombre tablaorigen tabladest
## 1         1 107      2  Comuna 2         626       187
## 2         2 108      1  Comuna 1        2250      3773
## 3         3 109      3  Comuna 3        1610      2887
## 4         4 110     19 Comuna 19        1193      1497
## 5         5 103     15 Comuna 15         521       440
## 6         6 104     17 Comuna 17         797       570
## 7         7 105     18 Comuna 18         583       598
## 8         8 106     22 Comuna 22         862       830
## 9         9  89      6  Comuna 6         737      1055
## 10       10  90      4  Comuna 4        1094       741
## 11       11  91      5  Comuna 5         717       483
## 12       12  92      7  Comuna 7         257       207
## 13       13  93      8  Comuna 8        1031       560
## 14       14  94      9  Comuna 9         575       316
## 15       15  95     21 Comuna 21         974       481
## 16       16  96     13 Comuna 13         836       645
## 17       17  97     12 Comuna 12        1762      1616
## 18       18  98     14 Comuna 14        1208       526
## 19       19  99     11 Comuna 11        2241      2441
## 20       20 100     10 Comuna 10         599       303
## 21       21 101     20 Comuna 20         693       434
## 22       22 102     16 Comuna 16         985      1561
etiqueta2 =paste(as.character(comunas$comuna),",",comunas$tabladest)
spl2 = list('sp.text', coordinates(comunas), etiqueta2, cex=.5)


plot2=spplot(comunas[,6],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.8),
             sp.layout = spl2, col='white')
par.settings = list(fontsize = list(text = 5))
plot2

En el caso de comuna de destino, vemos que a pesar de que la comuna 1 tiene gran salida de personas también ocupa el primer puesto recibiendo visitantes. El segundo puesto se lo lleba la comuna número 3.

Análisis de origen por tipo de vehículo

En cada uno de los siguientes análisis se filtra por el ID de tipo de vehículo de interés.

Bicicleta

EncuestaOrigenDestino3 = EncuestaOrigenDestino2 %>% filter(`TIPO DE VEHICULO` == "1")

cuentacomunaorgb = subset(data.frame(table(EncuestaOrigenDestino3$`comuna origen`)))
comunas@data$tablaorigenb=cuentacomunaorgb$Freq
comunas@data
##    OBJECTID gid comuna    nombre tablaorigen tabladest tablaorigenb
## 1         1 107      2  Comuna 2         626       187           32
## 2         2 108      1  Comuna 1        2250      3773          122
## 3         3 109      3  Comuna 3        1610      2887           84
## 4         4 110     19 Comuna 19        1193      1497           58
## 5         5 103     15 Comuna 15         521       440           28
## 6         6 104     17 Comuna 17         797       570           29
## 7         7 105     18 Comuna 18         583       598           30
## 8         8 106     22 Comuna 22         862       830           46
## 9         9  89      6  Comuna 6         737      1055           36
## 10       10  90      4  Comuna 4        1094       741           71
## 11       11  91      5  Comuna 5         717       483           42
## 12       12  92      7  Comuna 7         257       207           10
## 13       13  93      8  Comuna 8        1031       560           62
## 14       14  94      9  Comuna 9         575       316           32
## 15       15  95     21 Comuna 21         974       481           55
## 16       16  96     13 Comuna 13         836       645           65
## 17       17  97     12 Comuna 12        1762      1616          103
## 18       18  98     14 Comuna 14        1208       526           85
## 19       19  99     11 Comuna 11        2241      2441          113
## 20       20 100     10 Comuna 10         599       303           33
## 21       21 101     20 Comuna 20         693       434           35
## 22       22 102     16 Comuna 16         985      1561           52
etiqueta =paste(as.character(comunas$comuna),",",comunas$tablaorigenb)
spl = list('sp.text', coordinates(comunas), etiqueta, cex=.5)


plot3=spplot(comunas[,7],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.5),
             sp.layout = spl, col='white')
             par.settings = list(fontsize = list(text = 5))
plot3

La comuna número 1 presenta la mayor salida de personas en bicicleta con un total de 122, por el contrario la comuna 7 es la que menor vaijes presenta de esta forma.

Moto

EncuestaOrigenDestino4 = EncuestaOrigenDestino2 %>% filter(`TIPO DE VEHICULO` == "2")

cuentacomunaorgm = subset(data.frame(table(EncuestaOrigenDestino4$`comuna origen`)))
comunas@data$tablaorigenm=cuentacomunaorgm$Freq
comunas@data
##    OBJECTID gid comuna    nombre tablaorigen tabladest tablaorigenb
## 1         1 107      2  Comuna 2         626       187           32
## 2         2 108      1  Comuna 1        2250      3773          122
## 3         3 109      3  Comuna 3        1610      2887           84
## 4         4 110     19 Comuna 19        1193      1497           58
## 5         5 103     15 Comuna 15         521       440           28
## 6         6 104     17 Comuna 17         797       570           29
## 7         7 105     18 Comuna 18         583       598           30
## 8         8 106     22 Comuna 22         862       830           46
## 9         9  89      6  Comuna 6         737      1055           36
## 10       10  90      4  Comuna 4        1094       741           71
## 11       11  91      5  Comuna 5         717       483           42
## 12       12  92      7  Comuna 7         257       207           10
## 13       13  93      8  Comuna 8        1031       560           62
## 14       14  94      9  Comuna 9         575       316           32
## 15       15  95     21 Comuna 21         974       481           55
## 16       16  96     13 Comuna 13         836       645           65
## 17       17  97     12 Comuna 12        1762      1616          103
## 18       18  98     14 Comuna 14        1208       526           85
## 19       19  99     11 Comuna 11        2241      2441          113
## 20       20 100     10 Comuna 10         599       303           33
## 21       21 101     20 Comuna 20         693       434           35
## 22       22 102     16 Comuna 16         985      1561           52
##    tablaorigenm
## 1           296
## 2          1063
## 3           702
## 4           571
## 5           260
## 6           377
## 7           272
## 8           421
## 9           317
## 10          535
## 11          339
## 12          133
## 13          453
## 14          258
## 15          455
## 16          383
## 17          853
## 18          593
## 19          995
## 20          278
## 21          323
## 22          430
etiquetam =paste(as.character(comunas$comuna),",",comunas$tablaorigenm)
splm = list('sp.text', coordinates(comunas), etiquetam, cex=.5)


plot4=spplot(comunas[,8],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.5),
             sp.layout = splm, col='white')
par.settings = list(fontsize = list(text = 5))
plot4

Para el tipo de vehículo “moto” desde comuna de origen nuevamente la comuna uno lidera el ranking.

Carro

EncuestaOrigenDestino5 = EncuestaOrigenDestino2 %>% filter(`TIPO DE VEHICULO` == "3")

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


plot5=spplot(comunas[,9],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.5),
             sp.layout = splc, col='white')
par.settings = list(fontsize = list(text = 5))
plot5

Finalmente, contrario al patrón de los dos vehículos mostrados anteriormente, pare el caso del carro, la comuna 11 se configura con mayor cantidad de personas saliendo en este tipo de vehículo.

Análisis de destino por tipo de vehículo

Se evidencia que el comportamiento de uso en el tipo de vehículo para llegar a las diferentes comunas varía considerablemente respecto al origen. A continuación los resultados:

Bicicleta

EncuestaOrigenDestino6 = EncuestaOrigenDestino2 %>% filter(`TIPO DE VEHICULO` == "1")

cuentacomunadestb = subset(data.frame(table(EncuestaOrigenDestino6$`comuna destino`)))
comunas@data$tabladestb=cuentacomunadestb$Freq
comunas@data
##    OBJECTID gid comuna    nombre tablaorigen tabladest tablaorigenb
## 1         1 107      2  Comuna 2         626       187           32
## 2         2 108      1  Comuna 1        2250      3773          122
## 3         3 109      3  Comuna 3        1610      2887           84
## 4         4 110     19 Comuna 19        1193      1497           58
## 5         5 103     15 Comuna 15         521       440           28
## 6         6 104     17 Comuna 17         797       570           29
## 7         7 105     18 Comuna 18         583       598           30
## 8         8 106     22 Comuna 22         862       830           46
## 9         9  89      6  Comuna 6         737      1055           36
## 10       10  90      4  Comuna 4        1094       741           71
## 11       11  91      5  Comuna 5         717       483           42
## 12       12  92      7  Comuna 7         257       207           10
## 13       13  93      8  Comuna 8        1031       560           62
## 14       14  94      9  Comuna 9         575       316           32
## 15       15  95     21 Comuna 21         974       481           55
## 16       16  96     13 Comuna 13         836       645           65
## 17       17  97     12 Comuna 12        1762      1616          103
## 18       18  98     14 Comuna 14        1208       526           85
## 19       19  99     11 Comuna 11        2241      2441          113
## 20       20 100     10 Comuna 10         599       303           33
## 21       21 101     20 Comuna 20         693       434           35
## 22       22 102     16 Comuna 16         985      1561           52
##    tablaorigenm tablaorigenc tabladestb
## 1           296          234          9
## 2          1063          860        194
## 3           702          679        169
## 4           571          443         80
## 5           260          185         38
## 6           377          314         31
## 7           272          229         36
## 8           421          319         46
## 9           317          295         56
## 10          535          404         34
## 11          339          268         26
## 12          133           88         13
## 13          453          412         28
## 14          258          236         20
## 15          455          377         17
## 16          383          320         31
## 17          853          662         95
## 18          593          433         28
## 19          995          923        131
## 20          278          228         22
## 21          323          272         24
## 22          430          424         95
etiquetadb =paste(as.character(comunas$comuna),",",comunas$tabladestb)
spldb = list('sp.text', coordinates(comunas), etiquetadb, cex=.5)


plot6=spplot(comunas[,10],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.5),
             sp.layout = spldb, col='white')
par.settings = list(fontsize = list(text = 5))
plot6

La bicileta es el medio predilecto para llegar a las comunas 1 y 3.

Moto

EncuestaOrigenDestino7 = EncuestaOrigenDestino2 %>% filter(`TIPO DE VEHICULO` == "2")

cuentacomunadestm = subset(data.frame(table(EncuestaOrigenDestino7$`comuna destino`)))
comunas@data$tabladestm=cuentacomunadestm$Freq
comunas@data
##    OBJECTID gid comuna    nombre tablaorigen tabladest tablaorigenb
## 1         1 107      2  Comuna 2         626       187           32
## 2         2 108      1  Comuna 1        2250      3773          122
## 3         3 109      3  Comuna 3        1610      2887           84
## 4         4 110     19 Comuna 19        1193      1497           58
## 5         5 103     15 Comuna 15         521       440           28
## 6         6 104     17 Comuna 17         797       570           29
## 7         7 105     18 Comuna 18         583       598           30
## 8         8 106     22 Comuna 22         862       830           46
## 9         9  89      6  Comuna 6         737      1055           36
## 10       10  90      4  Comuna 4        1094       741           71
## 11       11  91      5  Comuna 5         717       483           42
## 12       12  92      7  Comuna 7         257       207           10
## 13       13  93      8  Comuna 8        1031       560           62
## 14       14  94      9  Comuna 9         575       316           32
## 15       15  95     21 Comuna 21         974       481           55
## 16       16  96     13 Comuna 13         836       645           65
## 17       17  97     12 Comuna 12        1762      1616          103
## 18       18  98     14 Comuna 14        1208       526           85
## 19       19  99     11 Comuna 11        2241      2441          113
## 20       20 100     10 Comuna 10         599       303           33
## 21       21 101     20 Comuna 20         693       434           35
## 22       22 102     16 Comuna 16         985      1561           52
##    tablaorigenm tablaorigenc tabladestb tabladestm
## 1           296          234          9         90
## 2          1063          860        194       1734
## 3           702          679        169       1333
## 4           571          443         80        678
## 5           260          185         38        183
## 6           377          314         31        255
## 7           272          229         36        279
## 8           421          319         46        382
## 9           317          295         56        512
## 10          535          404         34        353
## 11          339          268         26        217
## 12          133           88         13        106
## 13          453          412         28        285
## 14          258          236         20        150
## 15          455          377         17        232
## 16          383          320         31        290
## 17          853          662         95        744
## 18          593          433         28        240
## 19          995          923        131       1152
## 20          278          228         22        124
## 21          323          272         24        202
## 22          430          424         95        766
etiquetadm =paste(as.character(comunas$comuna),",",comunas$tabladestm)
spldm = list('sp.text', coordinates(comunas), etiquetadm, cex=.5)


plot7=spplot(comunas[,11],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.5),
             sp.layout = spldm, col='white')
par.settings = list(fontsize = list(text = 5))
plot7

Por su parte, la moto también es la elegida en las comunas y 3.

Carro

EncuestaOrigenDestino8 = EncuestaOrigenDestino2 %>% filter(`TIPO DE VEHICULO` == "3")

cuentacomunadestc = subset(data.frame(table(EncuestaOrigenDestino8$`comuna destino`)))
comunas@data$tabladestc=cuentacomunadestc$Freq
comunas@data
##    OBJECTID gid comuna    nombre tablaorigen tabladest tablaorigenb
## 1         1 107      2  Comuna 2         626       187           32
## 2         2 108      1  Comuna 1        2250      3773          122
## 3         3 109      3  Comuna 3        1610      2887           84
## 4         4 110     19 Comuna 19        1193      1497           58
## 5         5 103     15 Comuna 15         521       440           28
## 6         6 104     17 Comuna 17         797       570           29
## 7         7 105     18 Comuna 18         583       598           30
## 8         8 106     22 Comuna 22         862       830           46
## 9         9  89      6  Comuna 6         737      1055           36
## 10       10  90      4  Comuna 4        1094       741           71
## 11       11  91      5  Comuna 5         717       483           42
## 12       12  92      7  Comuna 7         257       207           10
## 13       13  93      8  Comuna 8        1031       560           62
## 14       14  94      9  Comuna 9         575       316           32
## 15       15  95     21 Comuna 21         974       481           55
## 16       16  96     13 Comuna 13         836       645           65
## 17       17  97     12 Comuna 12        1762      1616          103
## 18       18  98     14 Comuna 14        1208       526           85
## 19       19  99     11 Comuna 11        2241      2441          113
## 20       20 100     10 Comuna 10         599       303           33
## 21       21 101     20 Comuna 20         693       434           35
## 22       22 102     16 Comuna 16         985      1561           52
##    tablaorigenm tablaorigenc tabladestb tabladestm tabladestc
## 1           296          234          9         90         73
## 2          1063          860        194       1734       1518
## 3           702          679        169       1333       1098
## 4           571          443         80        678        596
## 5           260          185         38        183        181
## 6           377          314         31        255        208
## 7           272          229         36        279        224
## 8           421          319         46        382        325
## 9           317          295         56        512        382
## 10          535          404         34        353        291
## 11          339          268         26        217        204
## 12          133           88         13        106         71
## 13          453          412         28        285        189
## 14          258          236         20        150        120
## 15          455          377         17        232        199
## 16          383          320         31        290        275
## 17          853          662         95        744        650
## 18          593          433         28        240        216
## 19          995          923        131       1152        926
## 20          278          228         22        124        131
## 21          323          272         24        202        164
## 22          430          424         95        766        564
etiquetadc =paste(as.character(comunas$comuna),",",comunas$tabladestc)
spldc = list('sp.text', coordinates(comunas), etiquetadc, cex=.5)


plot8=spplot(comunas[,12],
             scales = list(draw = TRUE),  
             col.regions = rainbow(99, start=.5),
             sp.layout = spldc, col='white')
par.settings = list(fontsize = list(text = 5))
plot8

A diferencia de la comuna de origen, el carro lidera en la comuna 1.

Conclusiones

Las comunas 1 y 3 pertenecientes a las zonas noroccidente así como las 11 y 12 de la oriente, se configuran como aquellas desde donde salen y entran la mayoría de personas, lo cual podría indicar que se configuren como sitios turístico y/o comerciales.

En cuanto a movilidad por tipo de vehículo se encuentra que tanto la bicilieta, como moto y vehículo son los medios en los que menos se transportan los individuos de la comuna 7.Mientras que la bicicleta y moto son muy usadas en la comuna 1 y el carro en la 11.