suma
2+3
## [1] 5
Resta
2-3
## [1] -1
divisió
2/3
## [1] 0.6666667
multiplicación
2*3
## [1] 6
asignación de objetos
a=3
b=4
a>b
## [1] FALSE
Asignación vectorial
a=c(8,3,4,1)
b=c(2,4,1,1)
a*b
## [1] 16 12 4 1
b=c('F','M','F','F')
conociendo niveles de la variables
levels(factor(b))
## [1] "F" "M"
comparaciones lógicas
a>2.3
## [1] TRUE TRUE TRUE FALSE
Determinacion de longitud de vector
length(a)
## [1] 4
Generación de vectores por secuencias
x=1:4
otra forma
seq(1,4)
## [1] 1 2 3 4
Incrementos Perosnalizados seq(valor1,valor2,Incremento/Decremento)
seq(1,6,0.5)
## [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
rep(1,3)
## [1] 1 1 1
rep(c(1,2),1:2)
## [1] 1 2 2
rep("a",4)
## [1] "a" "a" "a" "a"
Los intervalos que definirán cada uno de los niveles
x=1:15
x
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
y=cut(x,breaks=c(0,5,10,15))
y
## [1] (0,5] (0,5] (0,5] (0,5] (0,5] (5,10] (5,10] (5,10]
## [9] (5,10] (5,10] (10,15] (10,15] (10,15] (10,15] (10,15]
## Levels: (0,5] (5,10] (10,15]
Ordenamiento de Vectores Indica la posición de los valores
order(a)
## [1] 4 2 3 1
ordena
a[order(a,decreasing = FALSE)]
## [1] 1 3 4 8
Trabajando con Matrices genera matrices a partir de un vector. Bastará para ello definir el número de filas, el número de columnas, y el modo en que se irá completando la matriz, bien por filas (byrow = T) bien por columnas (byrow = F).
x <- matrix(1:9,3,3,byrow = F)
x
## [,1] [,2] [,3]
## [1,] 1 4 7
## [2,] 2 5 8
## [3,] 3 6 9
y=diag(x)
creando una matriz de vectores con la diagonal
d=matrix(diag(y),ncol=3,nrow=3)
creando matrices triangulares -inferior
h=matrix(0,nrow=3,ncol=3)
h[lower.tri(x,diag=TRUE)]=1:6
h
## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 2 4 0
## [3,] 3 5 6
–superior
h=matrix(0,nrow=3,ncol=3)
h[upper.tri(x,diag=TRUE)]=1:6
h
## [,1] [,2] [,3]
## [1,] 1 2 4
## [2,] 0 3 5
## [3,] 0 0 6
Operaciones con matrices
x+x
## [,1] [,2] [,3]
## [1,] 2 8 14
## [2,] 4 10 16
## [3,] 6 12 18
##Incorrecto la Multiplicación
x*x
## [,1] [,2] [,3]
## [1,] 1 16 49
## [2,] 4 25 64
## [3,] 9 36 81
correcto
x%*%x
## [,1] [,2] [,3]
## [1,] 30 66 102
## [2,] 36 81 126
## [3,] 42 96 150
#transponer
t(x)
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 4 5 6
## [3,] 7 8 9
det(x)
## [1] 0
#Inversa Solve(x)
#operaciones avanzadas
colSums(x)
## [1] 6 15 24
rowSums(x)
## [1] 12 15 18
colMeans(x)
## [1] 2 5 8
rowMeans(x)
## [1] 4 5 6
La función cbind() unirá los vectores o matrices por columnas, y la función rbind() concatenará los vectores o matrices por filas.
cbind (c(1,2,3),c(4,5,6))
## [,1] [,2]
## [1,] 1 4
## [2,] 2 5
## [3,] 3 6
rbind (c(1,2,3),c(4,5,6))
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 4 5 6
sex=c('M','F','M','F')
edad=c(12,10,9,13)
sueldo=c(1200,2000,900,1500)
esta=c('s','c','s','s')
base=data.frame(sex,esta,edad,sueldo)
head(base)
## sex esta edad sueldo
## 1 M s 12 1200
## 2 F c 10 2000
## 3 M s 9 900
## 4 F s 13 1500
Manipulación de data frame
base
## sex esta edad sueldo
## 1 M s 12 1200
## 2 F c 10 2000
## 3 M s 9 900
## 4 F s 13 1500
base$sex
## [1] M F M F
## Levels: F M
base[1]#--Columna
## sex
## 1 M
## 2 F
## 3 M
## 4 F
base[,1]#--Vector
## [1] M F M F
## Levels: F M
base[2]
## esta
## 1 s
## 2 c
## 3 s
## 4 s
base[1,4]
## [1] 1200
base[2,3]
## [1] 10
base[1,]
## sex esta edad sueldo
## 1 M s 12 1200
base[3,]
## sex esta edad sueldo
## 3 M s 9 900
base[2:4]
## esta edad sueldo
## 1 s 12 1200
## 2 c 10 2000
## 3 s 9 900
## 4 s 13 1500
base[1:3,]
## sex esta edad sueldo
## 1 M s 12 1200
## 2 F c 10 2000
## 3 M s 9 900
creando una base de datos ponderada
refe=data.frame(sexo=rep("Masc",30),riesgo=rep("Alt",30))
fr=data.frame(sexo=rep("Masc",20),riesgo=rep("Med",20))
refe=rbind(refe,fr)
table(refe[,1],refe[,2])
##
## Alt Med
## Masc 30 20
fr=data.frame(sexo=rep("Masc",10),riesgo=rep("Baj",10))
refe=rbind(refe,fr)
table(refe[,1],refe[,2])
##
## Alt Med Baj
## Masc 30 20 10
fr=data.frame(sexo=rep("Fem",15),riesgo=rep("Alt",15))
refe=rbind(refe,fr)
table(refe[,1],refe[,2])
##
## Alt Med Baj
## Masc 30 20 10
## Fem 15 0 0
fr=data.frame(sexo=rep("Fem",10),riesgo=rep("Med",10))
refe=rbind(refe,fr)
table(refe[,1],refe[,2])
##
## Alt Med Baj
## Masc 30 20 10
## Fem 15 10 0
fr=data.frame(sexo=rep("Fem",20),riesgo=rep("Baj",20))
refe=rbind(refe,fr)
table(refe[,1],refe[,2])
##
## Alt Med Baj
## Masc 30 20 10
## Fem 15 10 20
head(refe)
## sexo riesgo
## 1 Masc Alt
## 2 Masc Alt
## 3 Masc Alt
## 4 Masc Alt
## 5 Masc Alt
## 6 Masc Alt
refe$edad=round(runif(105,12,80),0)
head(refe)
## sexo riesgo edad
## 1 Masc Alt 66
## 2 Masc Alt 25
## 3 Masc Alt 52
## 4 Masc Alt 30
## 5 Masc Alt 23
## 6 Masc Alt 70
Recodificando Variables
levels(refe[,2])
## [1] "Alt" "Med" "Baj"
riesgo.nu=as.numeric(refe[,2])
refe$calf[riesgo.nu==1]='Bueno'
refe$calf[riesgo.nu>1]='Malo'
head(refe)
## sexo riesgo edad calf
## 1 Masc Alt 66 Bueno
## 2 Masc Alt 25 Bueno
## 3 Masc Alt 52 Bueno
## 4 Masc Alt 30 Bueno
## 5 Masc Alt 23 Bueno
## 6 Masc Alt 70 Bueno
refe$edadint[refe[,3]<25]='14 a 24'
refe$edadint[refe[,3]>=25 & refe[,3]<35]='25 a 34'
refe$edadint[refe[,3]>=35 & refe[,3]<45]='35 a 44'
refe$edadint[refe[,3]>=45]='45 a más'
head(refe)
## sexo riesgo edad calf edadint
## 1 Masc Alt 66 Bueno 45 a más
## 2 Masc Alt 25 Bueno 25 a 34
## 3 Masc Alt 52 Bueno 45 a más
## 4 Masc Alt 30 Bueno 25 a 34
## 5 Masc Alt 23 Bueno 14 a 24
## 6 Masc Alt 70 Bueno 45 a más
otra Manera de crear cortes en el grupo
refe$edadint1=cut(refe[,3], breaks=c(14, 25, 35, 45,100),include.lowest=TRUE)
más variables
refe$talla=round(runif(105,60,170),2)
refe$T_eda=round(refe[,3]/refe[,7],2)
head(refe)
## sexo riesgo edad calf edadint edadint1 talla T_eda
## 1 Masc Alt 66 Bueno 45 a más (45,100] 142.55 0.46
## 2 Masc Alt 25 Bueno 25 a 34 [14,25] 161.43 0.15
## 3 Masc Alt 52 Bueno 45 a más (45,100] 68.63 0.76
## 4 Masc Alt 30 Bueno 25 a 34 (25,35] 142.49 0.21
## 5 Masc Alt 23 Bueno 14 a 24 [14,25] 164.33 0.14
## 6 Masc Alt 70 Bueno 45 a más (45,100] 89.73 0.78
Introducir de al trabajo con base de datos Para saber cuál es directorio de trabajo getwd(). Definiendo directorio inicial
dire<-getwd ()
Definiendo directorio de trabajo. setwd(Url del nuevo directorio) ejempl: “D:/Escritorio/escritorio/TallerMexEdo/Muestreo”.
setwd("C:/Users/Alumno/Desktop/baseTaller")
getwd ()
## [1] "C:/Users/Alumno/Desktop/baseTaller"
. Lectura de Datos. Para leer archivos planos:
da=read.table("C:/Users/Alumno/Desktop/baseTaller/est1.txt",T)
head(da)
## sex edad salario condicon
## 1 F 18 14796 Est
## 2 F 77 18808 Est
## 3 M 40 7958 Contr
## 4 M 60 18120 Est
## 5 M 66 5643 Est
## 6 M 28 18802 Contr
Lectura de Archivos Spss
library(foreign)
gor=read.spss("C:/Users/Alumno/Desktop/baseTaller/gorriones.sav")
## re-encoding from UTF-8
head(gor)
## $x1
## [1] 156 154 153 153 155 163 157 155 164 158 158 160 161 157 157 156 158
## [18] 153 155 163 159 155 156 160 152 160 155 157 165 153 162 162 159 159
## [35] 155 162 152 159 155 163 163 156 159 161 155 162 153 162 164 NA
##
## $x2
## [1] 245 240 240 236 243 247 238 239 248 238 240 244 246 245 235 237 244
## [18] 238 236 246 236 240 240 242 232 250 237 245 245 231 239 243 245 247
## [35] 243 252 230 242 238 249 242 237 238 245 235 247 237 245 248 NA
##
## $x3
## [1] 31.6 30.4 31.0 30.9 31.5 32.0 30.9 32.8 32.7 31.0 31.3 31.1 32.3 32.0
## [15] 31.5 30.9 31.4 30.5 30.3 32.5 31.5 31.4 31.5 32.6 30.3 31.7 31.0 32.2
## [29] 33.1 30.1 30.3 31.6 31.8 30.9 30.9 31.9 30.4 30.8 31.2 33.4 31.0 31.7
## [43] 31.5 32.1 30.7 31.9 30.6 32.5 32.3 NA
##
## $x4
## [1] 18.5 17.9 18.4 17.7 18.6 19.0 18.4 18.6 19.1 18.8 18.6 18.6 19.3 19.1
## [15] 18.1 18.0 18.5 18.2 18.5 18.6 18.0 18.0 18.2 18.8 17.2 18.8 18.5 19.5
## [29] 19.8 17.3 18.0 18.8 18.5 18.1 18.5 19.1 17.3 18.2 17.9 19.5 18.1 18.2
## [43] 18.4 19.1 17.7 19.1 18.6 18.5 18.8 NA
##
## $x5
## [1] 20.5 19.6 20.6 20.2 20.3 20.9 20.2 21.2 21.1 22.0 22.0 20.5 21.8 20.0
## [15] 19.8 20.3 21.6 20.9 20.1 21.9 21.5 20.7 20.6 21.7 19.8 22.5 20.0 21.4
## [29] 22.7 19.8 23.1 21.3 21.7 19.0 21.3 22.2 18.6 20.5 19.3 22.8 20.7 20.3
## [43] 20.3 20.8 19.6 20.4 20.4 21.1 20.9 NA
##
## $sobrevi
## [1] sobrevivió sobrevivió sobrevivió sobrevivió sobrevivió sobrevivió
## [7] sobrevivió sobrevivió sobrevivió sobrevivió sobrevivió sobrevivió
## [13] sobrevivió sobrevivió sobrevivió sobrevivió sobrevivió sobrevivió
## [19] sobrevivió sobrevivió sobrevivió murió murió murió
## [25] murió murió murió murió murió murió
## [31] murió murió murió murió murió murió
## [37] murió murió murió murió murió murió
## [43] murió murió murió murió murió murió
## [49] murió <NA>
## Levels: sobrevivió murió
Lectura de de excel
library(readxl)
pobre=read_excel("C:\\Users\\Alumno\\Desktop\\baseTaller\\estpobre.xlsx")
head(pobre)
## # A tibble: 6 x 8
## UBIGEO DISTRITO POBLACIÓN POBRES EXTREMO NOEXTREMO NOPOBRE COVARNO
## <dbl> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 150101 LIMA 302056 12.3 0.5 11.8 87.7 6.7
## 2 150102 ANCÓN 36401 19.6 0.8 18.8 80.4 8.9
## 3 150103 ATE 521692 18.9 0.7 18.2 81.1 6.2
## 4 150104 BARRANCO 33996 5.3 0.2 5.1 94.7 18.6
## 5 150105 BREÑA 82987 8.5 0.3 8.3 91.5 13.1
## 6 150106 CARABAYLLO 237269 26.3 1.5 24.8 73.7 4.9
otra forma pobre=read.delim(“clipboard”) ojo: Ctrl+C en todo la base de datos. Lectura de información de Base de datos dbf
library(foreign)
shp1=read.dbf("C:/Users/Alumno/Desktop/baseTaller/SHP/DISA_V_LC.dbf")
Manipulación con comando SQL install.packages(“sqldf”) Juntar dos tables con una condicion
library(sqldf)
## Loading required package: gsubfn
## Loading required package: proto
## Loading required package: RSQLite
junto=sqldf("select shp1.*,pobre.POBRES from shp1 join pobre on shp1.CDPTO=pobre.UBIGEO")
head(junto)
## AREA PERIMETER DIST98_ DIST98_ID REGION DEPARTAMEN PROVINCIA
## 1 321420000 96419.35 957 892 LIMA LIMA LIMA
## 2 358170000 105376.00 971 904 LIMA LIMA LIMA
## 3 20290960 23232.29 996 916 LIMA LIMA LIMA
## 4 49210800 41955.93 1005 923 LIMA LIMA LIMA
## 5 47864320 34454.24 1025 943 LIMA LIMA LIMA
## 6 18006220 24904.95 1032 950 LIMA LIMA LIMA
## DIST C_DIST CDPTO PROCOD DPTO REG AREHAS CAPI
## 1 ANCON ANCON 150102 1501 15 12 32141.82 2
## 2 CARABAYLLO CARABAYLLO 150106 1501 15 12 35816.94 6
## 3 SANTA ROSA SANTA ROSA 150139 1501 15 12 2029.10 39
## 4 PUENTE PIEDRA PUENTE PIEDRA 150125 1501 15 12 4921.08 25
## 5 COMAS LA LIBERTAD 150110 1501 15 12 4786.43 10
## 6 LOS OLIVOS LAS PALMERAS 150117 1501 15 12 1800.62 17
## ZRUEBOLA_P ZRUBEOLA_P DISAV Redes tasa tasa_1 POBRES
## 1 0.00 0.00 1 Red Puente Piedra 2091.26 2091.26 19.6
## 2 0.00 0.00 2 Red Tupac Amaru 1837.96 1837.96 26.3
## 3 0.00 0.00 1 Red Puente Piedra 3875.39 3875.39 12.0
## 4 0.00 0.00 1 Red Puente Piedra 1235.84 1235.84 35.6
## 5 0.00 0.00 2 Red Tupac Amaru 1947.73 1947.73 22.3
## 6 91.81 98.82 3 Red Rimac - SMP-LO 1561.02 1561.02 13.4
## POBRES__23 POBRES__24 POBRES__25 POBRES__26 POBRES__27 POBRES__28
## 1 19.6 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## 3 12.0 12.0 12.0 12.0 12.0 12.0
## 4 35.6 35.6 35.6 35.6 35.6 35.6
## 5 22.3 22.3 22.3 22.3 22.3 22.3
## 6 13.4 13.4 13.4 13.4 13.4 13.4
## POBRES__29 POBRES__30 POBRES__31 POBRES__32 POBRES__33 POBRES__34
## 1 19.6 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## 3 12.0 12.0 12.0 12.0 12.0 12.0
## 4 35.6 35.6 35.6 35.6 35.6 35.6
## 5 22.3 22.3 22.3 22.3 22.3 22.3
## 6 13.4 13.4 13.4 13.4 13.4 13.4
## POBRES__35 POBRES__36 POBRES__37 POBRES__38 POBRES__39 POBRES__40
## 1 19.6 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## 3 12.0 12.0 12.0 12.0 12.0 12.0
## 4 35.6 35.6 35.6 35.6 35.6 35.6
## 5 22.3 22.3 22.3 22.3 22.3 22.3
## 6 13.4 13.4 13.4 13.4 13.4 13.4
## POBRES__41 POBRES__42 POBRES__43 POBRES__44 POBRES__45 POBRES..46
## 1 19.6 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## 3 12.0 12.0 12.0 12.0 12.0 12.0
## 4 35.6 35.6 35.6 35.6 35.6 35.6
## 5 22.3 22.3 22.3 22.3 22.3 22.3
## 6 13.4 13.4 13.4 13.4 13.4 13.4
Guardando la información Cartográfica
write.dbf(junto,"C:\\Users\\Alumno\\Desktop\\baseTaller\\SHP\\DISA_V_LC.dbf")
Mostrando resultados
sqldf("select Redes, avg(POBRES) as promedio from junto group by Redes")
## Redes promedio
## 1 Red Lima Ciudad 4.807692
## 2 Red Puente Piedra 22.400000
## 3 Red Rimac - SMP-LO 13.600000
## 4 Red Tupac Amaru 23.300000
sqldf("select Redes, sum(POBRES) as suma from junto group by Redes")
## Redes suma
## 1 Red Lima Ciudad 62.5
## 2 Red Puente Piedra 67.2
## 3 Red Rimac - SMP-LO 40.8
## 4 Red Tupac Amaru 69.9
sqldf("select DIST, tasa, tasa/POBRES from junto where POBRES>10")
## DIST tasa tasa/POBRES
## 1 ANCON 2091.26 106.69694
## 2 CARABAYLLO 1837.96 69.88441
## 3 SANTA ROSA 3875.39 322.94917
## 4 PUENTE PIEDRA 1235.84 34.71461
## 5 COMAS 1947.73 87.34215
## 6 LOS OLIVOS 1561.02 116.49403
## 7 SAN MARTIN DE PORRES 1066.86 97.87706
## 8 INDEPENDENCIA 2466.98 115.82066
## 9 RIMAC 2678.87 162.35576
## 10 LIMA 3884.46 315.80976
## 11 LA VICTORIA 3240.60 217.48993
sqldf("select * from junto where CDPTO in (150102,150106)")
## AREA PERIMETER DIST98_ DIST98_ID REGION DEPARTAMEN PROVINCIA
## 1 321420000 96419.35 957 892 LIMA LIMA LIMA
## 2 358170000 105376.00 971 904 LIMA LIMA LIMA
## DIST C_DIST CDPTO PROCOD DPTO REG AREHAS CAPI ZRUEBOLA_P
## 1 ANCON ANCON 150102 1501 15 12 32141.82 2 0
## 2 CARABAYLLO CARABAYLLO 150106 1501 15 12 35816.94 6 0
## ZRUBEOLA_P DISAV Redes tasa tasa_1 POBRES POBRES__23
## 1 0 1 Red Puente Piedra 2091.26 2091.26 19.6 19.6
## 2 0 2 Red Tupac Amaru 1837.96 1837.96 26.3 26.3
## POBRES__24 POBRES__25 POBRES__26 POBRES__27 POBRES__28 POBRES__29
## 1 19.6 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## POBRES__30 POBRES__31 POBRES__32 POBRES__33 POBRES__34 POBRES__35
## 1 19.6 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## POBRES__36 POBRES__37 POBRES__38 POBRES__39 POBRES__40 POBRES__41
## 1 19.6 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## POBRES__42 POBRES__43 POBRES__44 POBRES__45 POBRES..46
## 1 19.6 19.6 19.6 19.6 19.6
## 2 26.3 26.3 26.3 26.3 26.3
sqldf("select * from junto order by POBRES desc")
## AREA PERIMETER DIST98_ DIST98_ID REGION DEPARTAMEN PROVINCIA
## 1 49210800 41955.930 1005 923 LIMA LIMA LIMA
## 2 358170000 105376.000 971 904 LIMA LIMA LIMA
## 3 47864320 34454.240 1025 943 LIMA LIMA LIMA
## 4 16112040 17313.060 1044 962 LIMA LIMA LIMA
## 5 321420000 96419.350 957 892 LIMA LIMA LIMA
## 6 12010940 16282.920 1055 972 LIMA LIMA LIMA
## 7 9251794 13832.300 1077 994 LIMA LIMA LIMA
## 8 18006220 24904.950 1032 950 LIMA LIMA LIMA
## 9 21872840 37121.760 1062 979 LIMA LIMA LIMA
## 10 20290960 23232.290 996 916 LIMA LIMA LIMA
## 11 36715170 42542.860 1039 957 LIMA LIMA LIMA
## 12 3322820 7340.514 1072 989 LIMA LIMA LIMA
## 13 3690265 10989.380 1079 996 LIMA LIMA LIMA
## 14 4588886 11482.940 1102 1019 LIMA LIMA LIMA
## 15 2803376 7774.696 1090 1007 LIMA LIMA LIMA
## 16 10226230 14812.450 1081 998 LIMA LIMA LIMA
## 17 3788446 7989.482 1092 1009 LIMA LIMA LIMA
## 18 4557510 8930.720 1086 1003 LIMA LIMA LIMA
## 19 4274468 9458.462 1084 1001 LIMA LIMA LIMA
## 20 10083760 13071.500 1091 1008 LIMA LIMA LIMA
## 21 9388095 19594.560 1103 1020 LIMA LIMA LIMA
## 22 8769509 16087.280 1094 1011 LIMA LIMA LIMA
## DIST C_DIST CDPTO PROCOD DPTO REG
## 1 PUENTE PIEDRA PUENTE PIEDRA 150125 1501 15 12
## 2 CARABAYLLO CARABAYLLO 150106 1501 15 12
## 3 COMAS LA LIBERTAD 150110 1501 15 12
## 4 INDEPENDENCIA INDEPENDENCIA 150112 1501 15 12
## 5 ANCON ANCON 150102 1501 15 12
## 6 RIMAC RIMAC 150128 1501 15 12
## 7 LA VICTORIA LA VICTORIA 150115 1501 15 12
## 8 LOS OLIVOS LAS PALMERAS 150117 1501 15 12
## 9 LIMA LIMA 150101 1501 15 12
## 10 SANTA ROSA SANTA ROSA 150139 1501 15 12
## 11 SAN MARTIN DE PORRES BARRIO OBRERO 150135 1501 15 12
## 12 BREÃA BREñA 150105 1501 15 12
## 13 SAN LUIS SAN LUIS 150134 1501 15 12
## 14 SURQUILLO SURQUILLO 150141 1501 15 12
## 15 LINCE LINCE 150116 1501 15 12
## 16 SAN MIGUEL SAN MIGUEL 150136 1501 15 12
## 17 MAGDALENA DEL MAR MAGDALENA DEL MAR 150120 1501 15 12
## 18 PUEBLO LIBRE PUEBLO LIBRE 150121 1501 15 12
## 19 JESUS MARIA JESUS MARIA 150113 1501 15 12
## 20 SAN BORJA SAN FRANCISCO DE BORJA 150130 1501 15 12
## 21 MIRAFLORES MIRAFLORES 150122 1501 15 12
## 22 SAN ISIDRO SAN ISIDRO 150131 1501 15 12
## AREHAS CAPI ZRUEBOLA_P ZRUBEOLA_P DISAV Redes tasa
## 1 4921.08 25 0.00 0.00 1 Red Puente Piedra 1235.84
## 2 35816.94 6 0.00 0.00 2 Red Tupac Amaru 1837.96
## 3 4786.43 10 0.00 0.00 2 Red Tupac Amaru 1947.73
## 4 1611.20 12 0.00 0.00 2 Red Tupac Amaru 2466.98
## 5 32141.82 2 0.00 0.00 1 Red Puente Piedra 2091.26
## 6 1201.09 28 96.97 125.17 3 Red Rimac - SMP-LO 2678.87
## 7 925.18 15 0.00 0.00 4 Red Lima Ciudad 3240.60
## 8 1800.62 17 91.81 98.82 3 Red Rimac - SMP-LO 1561.02
## 9 2187.28 1 0.00 0.00 4 Red Lima Ciudad 3884.46
## 10 2029.10 39 0.00 0.00 1 Red Puente Piedra 3875.39
## 11 3671.52 35 109.01 78.89 3 Red Rimac - SMP-LO 1066.86
## 12 332.28 5 0.00 0.00 4 Red Lima Ciudad 2743.75
## 13 369.03 34 0.00 0.00 4 Red Lima Ciudad 1773.72
## 14 458.89 41 0.00 0.00 4 Red Lima Ciudad 2221.46
## 15 280.34 16 0.00 0.00 4 Red Lima Ciudad 3320.03
## 16 1022.62 36 0.00 0.00 4 Red Lima Ciudad 1517.38
## 17 378.84 20 0.00 0.00 4 Red Lima Ciudad 1873.54
## 18 455.75 21 0.00 0.00 4 Red Lima Ciudad 1753.49
## 19 427.45 13 0.00 0.00 4 Red Lima Ciudad 2810.21
## 20 1008.38 30 0.00 0.00 4 Red Lima Ciudad 1681.61
## 21 938.81 22 0.00 0.00 4 Red Lima Ciudad 1471.87
## 22 876.95 31 0.00 0.00 4 Red Lima Ciudad 777.40
## tasa_1 POBRES POBRES__23 POBRES__24 POBRES__25 POBRES__26 POBRES__27
## 1 1235.84 35.6 35.6 35.6 35.6 35.6 35.6
## 2 1837.96 26.3 26.3 26.3 26.3 26.3 26.3
## 3 1947.73 22.3 22.3 22.3 22.3 22.3 22.3
## 4 2466.98 21.3 21.3 21.3 21.3 21.3 21.3
## 5 2091.26 19.6 19.6 19.6 19.6 19.6 19.6
## 6 2678.87 16.5 16.5 16.5 16.5 16.5 16.5
## 7 3240.60 14.9 14.9 14.9 14.9 14.9 14.9
## 8 1561.02 13.4 13.4 13.4 13.4 13.4 13.4
## 9 3884.46 12.3 12.3 12.3 12.3 12.3 12.3
## 10 3875.39 12.0 12.0 12.0 12.0 12.0 12.0
## 11 1066.86 10.9 10.9 10.9 10.9 10.9 10.9
## 12 2743.75 8.5 8.5 8.5 8.5 8.5 8.5
## 13 1773.72 7.1 7.1 7.1 7.1 7.1 7.1
## 14 2221.46 5.2 5.2 5.2 5.2 5.2 5.2
## 15 3320.03 4.0 4.0 4.0 4.0 4.0 4.0
## 16 1517.38 2.3 2.3 2.3 2.3 2.3 2.3
## 17 1873.54 2.3 2.3 2.3 2.3 2.3 2.3
## 18 1753.49 2.0 2.0 2.0 2.0 2.0 2.0
## 19 2810.21 1.7 1.7 1.7 1.7 1.7 1.7
## 20 1681.61 0.8 0.8 0.8 0.8 0.8 0.8
## 21 1471.87 0.8 0.8 0.8 0.8 0.8 0.8
## 22 777.40 0.6 0.6 0.6 0.6 0.6 0.6
## POBRES__28 POBRES__29 POBRES__30 POBRES__31 POBRES__32 POBRES__33
## 1 35.6 35.6 35.6 35.6 35.6 35.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## 3 22.3 22.3 22.3 22.3 22.3 22.3
## 4 21.3 21.3 21.3 21.3 21.3 21.3
## 5 19.6 19.6 19.6 19.6 19.6 19.6
## 6 16.5 16.5 16.5 16.5 16.5 16.5
## 7 14.9 14.9 14.9 14.9 14.9 14.9
## 8 13.4 13.4 13.4 13.4 13.4 13.4
## 9 12.3 12.3 12.3 12.3 12.3 12.3
## 10 12.0 12.0 12.0 12.0 12.0 12.0
## 11 10.9 10.9 10.9 10.9 10.9 10.9
## 12 8.5 8.5 8.5 8.5 8.5 8.5
## 13 7.1 7.1 7.1 7.1 7.1 7.1
## 14 5.2 5.2 5.2 5.2 5.2 5.2
## 15 4.0 4.0 4.0 4.0 4.0 4.0
## 16 2.3 2.3 2.3 2.3 2.3 2.3
## 17 2.3 2.3 2.3 2.3 2.3 2.3
## 18 2.0 2.0 2.0 2.0 2.0 2.0
## 19 1.7 1.7 1.7 1.7 1.7 1.7
## 20 0.8 0.8 0.8 0.8 0.8 0.8
## 21 0.8 0.8 0.8 0.8 0.8 0.8
## 22 0.6 0.6 0.6 0.6 0.6 0.6
## POBRES__34 POBRES__35 POBRES__36 POBRES__37 POBRES__38 POBRES__39
## 1 35.6 35.6 35.6 35.6 35.6 35.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## 3 22.3 22.3 22.3 22.3 22.3 22.3
## 4 21.3 21.3 21.3 21.3 21.3 21.3
## 5 19.6 19.6 19.6 19.6 19.6 19.6
## 6 16.5 16.5 16.5 16.5 16.5 16.5
## 7 14.9 14.9 14.9 14.9 14.9 14.9
## 8 13.4 13.4 13.4 13.4 13.4 13.4
## 9 12.3 12.3 12.3 12.3 12.3 12.3
## 10 12.0 12.0 12.0 12.0 12.0 12.0
## 11 10.9 10.9 10.9 10.9 10.9 10.9
## 12 8.5 8.5 8.5 8.5 8.5 8.5
## 13 7.1 7.1 7.1 7.1 7.1 7.1
## 14 5.2 5.2 5.2 5.2 5.2 5.2
## 15 4.0 4.0 4.0 4.0 4.0 4.0
## 16 2.3 2.3 2.3 2.3 2.3 2.3
## 17 2.3 2.3 2.3 2.3 2.3 2.3
## 18 2.0 2.0 2.0 2.0 2.0 2.0
## 19 1.7 1.7 1.7 1.7 1.7 1.7
## 20 0.8 0.8 0.8 0.8 0.8 0.8
## 21 0.8 0.8 0.8 0.8 0.8 0.8
## 22 0.6 0.6 0.6 0.6 0.6 0.6
## POBRES__40 POBRES__41 POBRES__42 POBRES__43 POBRES__44 POBRES__45
## 1 35.6 35.6 35.6 35.6 35.6 35.6
## 2 26.3 26.3 26.3 26.3 26.3 26.3
## 3 22.3 22.3 22.3 22.3 22.3 22.3
## 4 21.3 21.3 21.3 21.3 21.3 21.3
## 5 19.6 19.6 19.6 19.6 19.6 19.6
## 6 16.5 16.5 16.5 16.5 16.5 16.5
## 7 14.9 14.9 14.9 14.9 14.9 14.9
## 8 13.4 13.4 13.4 13.4 13.4 13.4
## 9 12.3 12.3 12.3 12.3 12.3 12.3
## 10 12.0 12.0 12.0 12.0 12.0 12.0
## 11 10.9 10.9 10.9 10.9 10.9 10.9
## 12 8.5 8.5 8.5 8.5 8.5 8.5
## 13 7.1 7.1 7.1 7.1 7.1 7.1
## 14 5.2 5.2 5.2 5.2 5.2 5.2
## 15 4.0 4.0 4.0 4.0 4.0 4.0
## 16 2.3 2.3 2.3 2.3 2.3 2.3
## 17 2.3 2.3 2.3 2.3 2.3 2.3
## 18 2.0 2.0 2.0 2.0 2.0 2.0
## 19 1.7 1.7 1.7 1.7 1.7 1.7
## 20 0.8 0.8 0.8 0.8 0.8 0.8
## 21 0.8 0.8 0.8 0.8 0.8 0.8
## 22 0.6 0.6 0.6 0.6 0.6 0.6
## POBRES..46
## 1 35.6
## 2 26.3
## 3 22.3
## 4 21.3
## 5 19.6
## 6 16.5
## 7 14.9
## 8 13.4
## 9 12.3
## 10 12.0
## 11 10.9
## 12 8.5
## 13 7.1
## 14 5.2
## 15 4.0
## 16 2.3
## 17 2.3
## 18 2.0
## 19 1.7
## 20 0.8
## 21 0.8
## 22 0.6
sqldf("select * from junto order by POBRES asc")
## AREA PERIMETER DIST98_ DIST98_ID REGION DEPARTAMEN PROVINCIA
## 1 8769509 16087.280 1094 1011 LIMA LIMA LIMA
## 2 10083760 13071.500 1091 1008 LIMA LIMA LIMA
## 3 9388095 19594.560 1103 1020 LIMA LIMA LIMA
## 4 4274468 9458.462 1084 1001 LIMA LIMA LIMA
## 5 4557510 8930.720 1086 1003 LIMA LIMA LIMA
## 6 10226230 14812.450 1081 998 LIMA LIMA LIMA
## 7 3788446 7989.482 1092 1009 LIMA LIMA LIMA
## 8 2803376 7774.696 1090 1007 LIMA LIMA LIMA
## 9 4588886 11482.940 1102 1019 LIMA LIMA LIMA
## 10 3690265 10989.380 1079 996 LIMA LIMA LIMA
## 11 3322820 7340.514 1072 989 LIMA LIMA LIMA
## 12 36715170 42542.860 1039 957 LIMA LIMA LIMA
## 13 20290960 23232.290 996 916 LIMA LIMA LIMA
## 14 21872840 37121.760 1062 979 LIMA LIMA LIMA
## 15 18006220 24904.950 1032 950 LIMA LIMA LIMA
## 16 9251794 13832.300 1077 994 LIMA LIMA LIMA
## 17 12010940 16282.920 1055 972 LIMA LIMA LIMA
## 18 321420000 96419.350 957 892 LIMA LIMA LIMA
## 19 16112040 17313.060 1044 962 LIMA LIMA LIMA
## 20 47864320 34454.240 1025 943 LIMA LIMA LIMA
## 21 358170000 105376.000 971 904 LIMA LIMA LIMA
## 22 49210800 41955.930 1005 923 LIMA LIMA LIMA
## DIST C_DIST CDPTO PROCOD DPTO REG
## 1 SAN ISIDRO SAN ISIDRO 150131 1501 15 12
## 2 SAN BORJA SAN FRANCISCO DE BORJA 150130 1501 15 12
## 3 MIRAFLORES MIRAFLORES 150122 1501 15 12
## 4 JESUS MARIA JESUS MARIA 150113 1501 15 12
## 5 PUEBLO LIBRE PUEBLO LIBRE 150121 1501 15 12
## 6 SAN MIGUEL SAN MIGUEL 150136 1501 15 12
## 7 MAGDALENA DEL MAR MAGDALENA DEL MAR 150120 1501 15 12
## 8 LINCE LINCE 150116 1501 15 12
## 9 SURQUILLO SURQUILLO 150141 1501 15 12
## 10 SAN LUIS SAN LUIS 150134 1501 15 12
## 11 BREÃA BREñA 150105 1501 15 12
## 12 SAN MARTIN DE PORRES BARRIO OBRERO 150135 1501 15 12
## 13 SANTA ROSA SANTA ROSA 150139 1501 15 12
## 14 LIMA LIMA 150101 1501 15 12
## 15 LOS OLIVOS LAS PALMERAS 150117 1501 15 12
## 16 LA VICTORIA LA VICTORIA 150115 1501 15 12
## 17 RIMAC RIMAC 150128 1501 15 12
## 18 ANCON ANCON 150102 1501 15 12
## 19 INDEPENDENCIA INDEPENDENCIA 150112 1501 15 12
## 20 COMAS LA LIBERTAD 150110 1501 15 12
## 21 CARABAYLLO CARABAYLLO 150106 1501 15 12
## 22 PUENTE PIEDRA PUENTE PIEDRA 150125 1501 15 12
## AREHAS CAPI ZRUEBOLA_P ZRUBEOLA_P DISAV Redes tasa
## 1 876.95 31 0.00 0.00 4 Red Lima Ciudad 777.40
## 2 1008.38 30 0.00 0.00 4 Red Lima Ciudad 1681.61
## 3 938.81 22 0.00 0.00 4 Red Lima Ciudad 1471.87
## 4 427.45 13 0.00 0.00 4 Red Lima Ciudad 2810.21
## 5 455.75 21 0.00 0.00 4 Red Lima Ciudad 1753.49
## 6 1022.62 36 0.00 0.00 4 Red Lima Ciudad 1517.38
## 7 378.84 20 0.00 0.00 4 Red Lima Ciudad 1873.54
## 8 280.34 16 0.00 0.00 4 Red Lima Ciudad 3320.03
## 9 458.89 41 0.00 0.00 4 Red Lima Ciudad 2221.46
## 10 369.03 34 0.00 0.00 4 Red Lima Ciudad 1773.72
## 11 332.28 5 0.00 0.00 4 Red Lima Ciudad 2743.75
## 12 3671.52 35 109.01 78.89 3 Red Rimac - SMP-LO 1066.86
## 13 2029.10 39 0.00 0.00 1 Red Puente Piedra 3875.39
## 14 2187.28 1 0.00 0.00 4 Red Lima Ciudad 3884.46
## 15 1800.62 17 91.81 98.82 3 Red Rimac - SMP-LO 1561.02
## 16 925.18 15 0.00 0.00 4 Red Lima Ciudad 3240.60
## 17 1201.09 28 96.97 125.17 3 Red Rimac - SMP-LO 2678.87
## 18 32141.82 2 0.00 0.00 1 Red Puente Piedra 2091.26
## 19 1611.20 12 0.00 0.00 2 Red Tupac Amaru 2466.98
## 20 4786.43 10 0.00 0.00 2 Red Tupac Amaru 1947.73
## 21 35816.94 6 0.00 0.00 2 Red Tupac Amaru 1837.96
## 22 4921.08 25 0.00 0.00 1 Red Puente Piedra 1235.84
## tasa_1 POBRES POBRES__23 POBRES__24 POBRES__25 POBRES__26 POBRES__27
## 1 777.40 0.6 0.6 0.6 0.6 0.6 0.6
## 2 1681.61 0.8 0.8 0.8 0.8 0.8 0.8
## 3 1471.87 0.8 0.8 0.8 0.8 0.8 0.8
## 4 2810.21 1.7 1.7 1.7 1.7 1.7 1.7
## 5 1753.49 2.0 2.0 2.0 2.0 2.0 2.0
## 6 1517.38 2.3 2.3 2.3 2.3 2.3 2.3
## 7 1873.54 2.3 2.3 2.3 2.3 2.3 2.3
## 8 3320.03 4.0 4.0 4.0 4.0 4.0 4.0
## 9 2221.46 5.2 5.2 5.2 5.2 5.2 5.2
## 10 1773.72 7.1 7.1 7.1 7.1 7.1 7.1
## 11 2743.75 8.5 8.5 8.5 8.5 8.5 8.5
## 12 1066.86 10.9 10.9 10.9 10.9 10.9 10.9
## 13 3875.39 12.0 12.0 12.0 12.0 12.0 12.0
## 14 3884.46 12.3 12.3 12.3 12.3 12.3 12.3
## 15 1561.02 13.4 13.4 13.4 13.4 13.4 13.4
## 16 3240.60 14.9 14.9 14.9 14.9 14.9 14.9
## 17 2678.87 16.5 16.5 16.5 16.5 16.5 16.5
## 18 2091.26 19.6 19.6 19.6 19.6 19.6 19.6
## 19 2466.98 21.3 21.3 21.3 21.3 21.3 21.3
## 20 1947.73 22.3 22.3 22.3 22.3 22.3 22.3
## 21 1837.96 26.3 26.3 26.3 26.3 26.3 26.3
## 22 1235.84 35.6 35.6 35.6 35.6 35.6 35.6
## POBRES__28 POBRES__29 POBRES__30 POBRES__31 POBRES__32 POBRES__33
## 1 0.6 0.6 0.6 0.6 0.6 0.6
## 2 0.8 0.8 0.8 0.8 0.8 0.8
## 3 0.8 0.8 0.8 0.8 0.8 0.8
## 4 1.7 1.7 1.7 1.7 1.7 1.7
## 5 2.0 2.0 2.0 2.0 2.0 2.0
## 6 2.3 2.3 2.3 2.3 2.3 2.3
## 7 2.3 2.3 2.3 2.3 2.3 2.3
## 8 4.0 4.0 4.0 4.0 4.0 4.0
## 9 5.2 5.2 5.2 5.2 5.2 5.2
## 10 7.1 7.1 7.1 7.1 7.1 7.1
## 11 8.5 8.5 8.5 8.5 8.5 8.5
## 12 10.9 10.9 10.9 10.9 10.9 10.9
## 13 12.0 12.0 12.0 12.0 12.0 12.0
## 14 12.3 12.3 12.3 12.3 12.3 12.3
## 15 13.4 13.4 13.4 13.4 13.4 13.4
## 16 14.9 14.9 14.9 14.9 14.9 14.9
## 17 16.5 16.5 16.5 16.5 16.5 16.5
## 18 19.6 19.6 19.6 19.6 19.6 19.6
## 19 21.3 21.3 21.3 21.3 21.3 21.3
## 20 22.3 22.3 22.3 22.3 22.3 22.3
## 21 26.3 26.3 26.3 26.3 26.3 26.3
## 22 35.6 35.6 35.6 35.6 35.6 35.6
## POBRES__34 POBRES__35 POBRES__36 POBRES__37 POBRES__38 POBRES__39
## 1 0.6 0.6 0.6 0.6 0.6 0.6
## 2 0.8 0.8 0.8 0.8 0.8 0.8
## 3 0.8 0.8 0.8 0.8 0.8 0.8
## 4 1.7 1.7 1.7 1.7 1.7 1.7
## 5 2.0 2.0 2.0 2.0 2.0 2.0
## 6 2.3 2.3 2.3 2.3 2.3 2.3
## 7 2.3 2.3 2.3 2.3 2.3 2.3
## 8 4.0 4.0 4.0 4.0 4.0 4.0
## 9 5.2 5.2 5.2 5.2 5.2 5.2
## 10 7.1 7.1 7.1 7.1 7.1 7.1
## 11 8.5 8.5 8.5 8.5 8.5 8.5
## 12 10.9 10.9 10.9 10.9 10.9 10.9
## 13 12.0 12.0 12.0 12.0 12.0 12.0
## 14 12.3 12.3 12.3 12.3 12.3 12.3
## 15 13.4 13.4 13.4 13.4 13.4 13.4
## 16 14.9 14.9 14.9 14.9 14.9 14.9
## 17 16.5 16.5 16.5 16.5 16.5 16.5
## 18 19.6 19.6 19.6 19.6 19.6 19.6
## 19 21.3 21.3 21.3 21.3 21.3 21.3
## 20 22.3 22.3 22.3 22.3 22.3 22.3
## 21 26.3 26.3 26.3 26.3 26.3 26.3
## 22 35.6 35.6 35.6 35.6 35.6 35.6
## POBRES__40 POBRES__41 POBRES__42 POBRES__43 POBRES__44 POBRES__45
## 1 0.6 0.6 0.6 0.6 0.6 0.6
## 2 0.8 0.8 0.8 0.8 0.8 0.8
## 3 0.8 0.8 0.8 0.8 0.8 0.8
## 4 1.7 1.7 1.7 1.7 1.7 1.7
## 5 2.0 2.0 2.0 2.0 2.0 2.0
## 6 2.3 2.3 2.3 2.3 2.3 2.3
## 7 2.3 2.3 2.3 2.3 2.3 2.3
## 8 4.0 4.0 4.0 4.0 4.0 4.0
## 9 5.2 5.2 5.2 5.2 5.2 5.2
## 10 7.1 7.1 7.1 7.1 7.1 7.1
## 11 8.5 8.5 8.5 8.5 8.5 8.5
## 12 10.9 10.9 10.9 10.9 10.9 10.9
## 13 12.0 12.0 12.0 12.0 12.0 12.0
## 14 12.3 12.3 12.3 12.3 12.3 12.3
## 15 13.4 13.4 13.4 13.4 13.4 13.4
## 16 14.9 14.9 14.9 14.9 14.9 14.9
## 17 16.5 16.5 16.5 16.5 16.5 16.5
## 18 19.6 19.6 19.6 19.6 19.6 19.6
## 19 21.3 21.3 21.3 21.3 21.3 21.3
## 20 22.3 22.3 22.3 22.3 22.3 22.3
## 21 26.3 26.3 26.3 26.3 26.3 26.3
## 22 35.6 35.6 35.6 35.6 35.6 35.6
## POBRES..46
## 1 0.6
## 2 0.8
## 3 0.8
## 4 1.7
## 5 2.0
## 6 2.3
## 7 2.3
## 8 4.0
## 9 5.2
## 10 7.1
## 11 8.5
## 12 10.9
## 13 12.0
## 14 12.3
## 15 13.4
## 16 14.9
## 17 16.5
## 18 19.6
## 19 21.3
## 20 22.3
## 21 26.3
## 22 35.6
sqldf("select * from junto where DIST like '%l%'")
## AREA PERIMETER DIST98_ DIST98_ID REGION DEPARTAMEN PROVINCIA
## 1 358170000 105376.000 971 904 LIMA LIMA LIMA
## 2 18006220 24904.950 1032 950 LIMA LIMA LIMA
## 3 21872840 37121.760 1062 979 LIMA LIMA LIMA
## 4 9251794 13832.300 1077 994 LIMA LIMA LIMA
## 5 3690265 10989.380 1079 996 LIMA LIMA LIMA
## 6 10226230 14812.450 1081 998 LIMA LIMA LIMA
## 7 4557510 8930.720 1086 1003 LIMA LIMA LIMA
## 8 2803376 7774.696 1090 1007 LIMA LIMA LIMA
## 9 3788446 7989.482 1092 1009 LIMA LIMA LIMA
## 10 4588886 11482.940 1102 1019 LIMA LIMA LIMA
## 11 9388095 19594.560 1103 1020 LIMA LIMA LIMA
## DIST C_DIST CDPTO PROCOD DPTO REG AREHAS
## 1 CARABAYLLO CARABAYLLO 150106 1501 15 12 35816.94
## 2 LOS OLIVOS LAS PALMERAS 150117 1501 15 12 1800.62
## 3 LIMA LIMA 150101 1501 15 12 2187.28
## 4 LA VICTORIA LA VICTORIA 150115 1501 15 12 925.18
## 5 SAN LUIS SAN LUIS 150134 1501 15 12 369.03
## 6 SAN MIGUEL SAN MIGUEL 150136 1501 15 12 1022.62
## 7 PUEBLO LIBRE PUEBLO LIBRE 150121 1501 15 12 455.75
## 8 LINCE LINCE 150116 1501 15 12 280.34
## 9 MAGDALENA DEL MAR MAGDALENA DEL MAR 150120 1501 15 12 378.84
## 10 SURQUILLO SURQUILLO 150141 1501 15 12 458.89
## 11 MIRAFLORES MIRAFLORES 150122 1501 15 12 938.81
## CAPI ZRUEBOLA_P ZRUBEOLA_P DISAV Redes tasa tasa_1
## 1 6 0.00 0.00 2 Red Tupac Amaru 1837.96 1837.96
## 2 17 91.81 98.82 3 Red Rimac - SMP-LO 1561.02 1561.02
## 3 1 0.00 0.00 4 Red Lima Ciudad 3884.46 3884.46
## 4 15 0.00 0.00 4 Red Lima Ciudad 3240.60 3240.60
## 5 34 0.00 0.00 4 Red Lima Ciudad 1773.72 1773.72
## 6 36 0.00 0.00 4 Red Lima Ciudad 1517.38 1517.38
## 7 21 0.00 0.00 4 Red Lima Ciudad 1753.49 1753.49
## 8 16 0.00 0.00 4 Red Lima Ciudad 3320.03 3320.03
## 9 20 0.00 0.00 4 Red Lima Ciudad 1873.54 1873.54
## 10 41 0.00 0.00 4 Red Lima Ciudad 2221.46 2221.46
## 11 22 0.00 0.00 4 Red Lima Ciudad 1471.87 1471.87
## POBRES POBRES__23 POBRES__24 POBRES__25 POBRES__26 POBRES__27
## 1 26.3 26.3 26.3 26.3 26.3 26.3
## 2 13.4 13.4 13.4 13.4 13.4 13.4
## 3 12.3 12.3 12.3 12.3 12.3 12.3
## 4 14.9 14.9 14.9 14.9 14.9 14.9
## 5 7.1 7.1 7.1 7.1 7.1 7.1
## 6 2.3 2.3 2.3 2.3 2.3 2.3
## 7 2.0 2.0 2.0 2.0 2.0 2.0
## 8 4.0 4.0 4.0 4.0 4.0 4.0
## 9 2.3 2.3 2.3 2.3 2.3 2.3
## 10 5.2 5.2 5.2 5.2 5.2 5.2
## 11 0.8 0.8 0.8 0.8 0.8 0.8
## POBRES__28 POBRES__29 POBRES__30 POBRES__31 POBRES__32 POBRES__33
## 1 26.3 26.3 26.3 26.3 26.3 26.3
## 2 13.4 13.4 13.4 13.4 13.4 13.4
## 3 12.3 12.3 12.3 12.3 12.3 12.3
## 4 14.9 14.9 14.9 14.9 14.9 14.9
## 5 7.1 7.1 7.1 7.1 7.1 7.1
## 6 2.3 2.3 2.3 2.3 2.3 2.3
## 7 2.0 2.0 2.0 2.0 2.0 2.0
## 8 4.0 4.0 4.0 4.0 4.0 4.0
## 9 2.3 2.3 2.3 2.3 2.3 2.3
## 10 5.2 5.2 5.2 5.2 5.2 5.2
## 11 0.8 0.8 0.8 0.8 0.8 0.8
## POBRES__34 POBRES__35 POBRES__36 POBRES__37 POBRES__38 POBRES__39
## 1 26.3 26.3 26.3 26.3 26.3 26.3
## 2 13.4 13.4 13.4 13.4 13.4 13.4
## 3 12.3 12.3 12.3 12.3 12.3 12.3
## 4 14.9 14.9 14.9 14.9 14.9 14.9
## 5 7.1 7.1 7.1 7.1 7.1 7.1
## 6 2.3 2.3 2.3 2.3 2.3 2.3
## 7 2.0 2.0 2.0 2.0 2.0 2.0
## 8 4.0 4.0 4.0 4.0 4.0 4.0
## 9 2.3 2.3 2.3 2.3 2.3 2.3
## 10 5.2 5.2 5.2 5.2 5.2 5.2
## 11 0.8 0.8 0.8 0.8 0.8 0.8
## POBRES__40 POBRES__41 POBRES__42 POBRES__43 POBRES__44 POBRES__45
## 1 26.3 26.3 26.3 26.3 26.3 26.3
## 2 13.4 13.4 13.4 13.4 13.4 13.4
## 3 12.3 12.3 12.3 12.3 12.3 12.3
## 4 14.9 14.9 14.9 14.9 14.9 14.9
## 5 7.1 7.1 7.1 7.1 7.1 7.1
## 6 2.3 2.3 2.3 2.3 2.3 2.3
## 7 2.0 2.0 2.0 2.0 2.0 2.0
## 8 4.0 4.0 4.0 4.0 4.0 4.0
## 9 2.3 2.3 2.3 2.3 2.3 2.3
## 10 5.2 5.2 5.2 5.2 5.2 5.2
## 11 0.8 0.8 0.8 0.8 0.8 0.8
## POBRES..46
## 1 26.3
## 2 13.4
## 3 12.3
## 4 14.9
## 5 7.1
## 6 2.3
## 7 2.0
## 8 4.0
## 9 2.3
## 10 5.2
## 11 0.8
Lectura de información Cartografica install.packages(“raster”) install.packages(“rgdal”)
library(rgdal)
## Loading required package: sp
## rgdal: version: 1.3-3, (SVN revision 759)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20
## Path to GDAL shared files: C:/Users/Alumno/Documents/R/R-3.5.1/library/rgdal/gdal
## GDAL binary built with GEOS: TRUE
## Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
## Path to PROJ.4 shared files: C:/Users/Alumno/Documents/R/R-3.5.1/library/rgdal/proj
## Linking to sp version: 1.3-1
library(raster)
shp=shapefile("C:/Users/Alumno/Desktop/baseTaller/SHP/DISA_V_LC.shp")
data1 <- raster("C:/Users/Alumno/Desktop/baseTaller/NDVI_2000_03.tif")
plot(shp)
##colocando nombres
cord=coordinates(shp)
text(cord,labels=shp$DIST,cex=0.4)
plot(data1)
Manipulando shapes
##Colorear los mapas
nclr=4
##Creando tonos por color
#install.packages("RColorBrewer")
library(RColorBrewer)
pclr=brewer.pal(nclr,"Blues")
##creando Cortes por Grupo
##install.packages("classInt")
library(classInt)
## Loading required package: spData
## To access larger datasets in this package, install the spDataLarge
## package with: `install.packages('spDataLarge',
## repos='https://nowosad.github.io/drat/', type='source'))`
##
## Attaching package: 'spData'
## The following objects are masked _by_ '.GlobalEnv':
##
## x, y
class=classIntervals(shp$POBRES,nclr,style="quantile")
colo=findColours(class,pclr)
plot(shp,col=as.character(colo),border="grey",axes=T,main="Mapa de Pobresa",cex.main=1)
text(cord,labels=shp$DIST,cex=0.4)
legend("bottomright",legend=names(attr(colo,"table")),fill=attr(colo,"palette"),cex=0.80)
##recortes de mapas
shp2=shp[shp$CDPTO==c(150102,150106,150139),]
## Warning in shp$CDPTO == c(150102, 150106, 150139): longitud de objeto mayor
## no es múltiplo de la longitud de uno menor
plot(shp2)