[R-sig-Geo] +AFs-R-sig-Geo+AF0- +-AFs-R-sig-Geo+-AF0- Represent data on map

Rolando Valdez rvaldezr at gmail.com
Mon Jan 6 16:00:51 CET 2014


I could not work with the information by separately. I modified +ACI-manually+ACI- the +ACo-.dbf file associated to the +ACo-.shp file. I just pasted the columns with the information in the +ACo-.dbf file because I couldn't do it with R.

After that, I did:

library(sp)
library(maptools)
map +ADw-- readShapeSpatial(+ACI-ESTADOS+ACI-)
library(lattice)
trellis.par.set(sp.theme())
spplot(map, c(+ACI-A2010+ACI-, +ACI-A2013+ACI-, +ACI-A2000+ACI-, +ACI-A2005+ACI-), names.attr +AD0- c(+ACI-2010+ACI-, +ACI-2013+ACI-, +ACI-2000+ACI-, +ACI-2005+ACI-),
main +AD0- +ACI-Desempleo por estados en M+AOk-xico, 2000-2013+ACI-)

And this is the result: https://skydrive.live.com/redir?resid+AD0-C319779BEF3A0241+ACE-1539+ACY-authkey+AD0AIQ-AMe4-a2kRUFmAyM+ACY-v+AD0-3+ACY-ithint+AD0-photo+ACU-2c.png

Now, my trouble is the scale, that is in integer numbers, how do I can set the scale with decimals and the halves values (like 1.5, 2.5, 3.5.....)?.

I tried with:

spplot(map, c(+ACI-A2010+ACI-, +ACI-A2013+ACI-, +ACI-A2000+ACI-, +ACI-A2005+ACI-), names.attr +AD0- c(+ACI-2010+ACI-, +ACI-2013+ACI-, +ACI-2000+ACI-, +ACI-2005+ACI-),
main +AD0- +ACI-Desempleo por estados en M+AOk-xico, 2000-2013+ACI-, scale +AD0- 0.5, which +AD0- 2)

...and didn't work.

I hope you can help me.

Regards,

Rol+AH4-

-----Mensaje original-----
De: r-sig-geo-bounces+AEA-r-project.org +AFs-mailto:r-sig-geo-bounces+AEA-r-project.org+AF0- En nombre de Edzer Pebesma
Enviado el: domingo, 5 de enero de 2014 07:33 p. m.
Para: r-sig-geo+AEA-r-project.org
Asunto: Re: +AFs-R-sig-Geo+AF0- +-AFs-R-sig-Geo+-AF0- Represent data on map



On 01/04/2014 09:33 PM, Rolando Valdez wrote:
+AD4- It didn't work.
+AD4- 
+AD4APg- names(map)
+AD4- +AFs-1+AF0- +ACI-CVE+AF8-EDO+ACI-    +ACI-NOMBRE+AF8-EDO+ACI-
+AD4APg- names(unem)
+AD4- +AFs-1+AF0- +ACI-num+AF8-est+ACI- +ACI-est+ACI-     +ACI-X2000+ACI-   +ACI-X2005+ACI-   +ACI-X2010+ACI-   +ACI-X2013+ACI-  
+AD4APg- spplot(map, 'X2000')
+AD4- Error en +AGAAWw-.data.frame+AGA-(obj+AEA-data, zcol) : undefined columns selected
+AD4- 
no, because X2000 will be sought in object 'map'. In case 'map' and 'unem' have exactly identical geometries (polygons?), and these geometries occur in the same order, then

map+ACQ-X2000 +AD0- unem+ACQ-X2000

may suffice. If not, you might need to do a spatial match, e.g. by

library(sp)
data(meuse)
coordinates(meuse) +AD0- +AH4-x+-y
data(meuse.grid)
coordinates(meuse.grid) +AD0- +AH4-x+-y
gridded(meuse.grid) +AD0- TRUE

try(meuse+ACQ-dist +ADw-- meuse.grid+ACQ-dist) +ACM- fails, as geometries don't match

meuse+ACQ-dist +AD0- over(meuse, meuse.grid)+ACQ-dist +ACM- uses a spatial match

but still, if unem and map are both polygon geometries this may lead to errors, as over() finds (first) intersecting polygons, and neighbouring polygons touch each other, so intersect too.


+AD4- Is it a problema having separate shapefile information of statistic?, because there are two files, the .shp and csv, although these have the same identificator. I mean, the +ACI-CVE+AF8-EDO+ACI- +AD0- +ACI-num+AF8-est+ACI- and +ACI-NOMBRE+AF8-EDO+ACI- +AD0- +ACI-est+ACI- are the same value. I'm thinking if I have to paste the csv columns to the map object.
+AD4- 
+AD4- Thanks,
+AD4- 
+AD4- Rol+AH4-
+AD4- 
+AD4- -----Mensaje original-----
+AD4- De: MacQueen, Don +AFs-mailto:macqueen1+AEA-llnl.gov+AF0- Enviado el: s+AOE-bado, 4 de 
+AD4- enero de 2014 12:07 a. m.
+AD4- Para: Rolando Valdez+ADs- r-sig-geo+AEA-r-project.org
+AD4- Asunto: Re: +AFs-R-sig-Geo+AF0- Represent data on map
+AD4- 
+AD4- Cannot help much without more information, but try:
+AD4- 
+AD4-   names(map)
+AD4- 
+AD4- Then pick one of the column names. Apparently, +ACI-2000+ACI- is not the name of a column of data in the map object.
+AD4- If map is like unem, then perhaps
+AD4- 
+AD4-   spplot(map, 'X2000')
+AD4- 
+AD4- is what you need.
+AD4- 
+AD4- Note, the c() in
+AD4-   c(+ACI-2000+ACI-)
+AD4- is not necessary. Simply
+AD4-   +ACI-2000+ACI-
+AD4- would be sufficient.
+AD4- 
+AD4- I am not familiar with the readShapeSpatial function+ADs- I always use
+AD4- readOGR() from the sp package.
+AD4- 
+AD4- -Don
+AD4- 
+AD4- --
+AD4- Don MacQueen
+AD4- 
+AD4- Lawrence Livermore National Laboratory
+AD4- 7000 East Ave., L-627
+AD4- Livermore, CA 94550
+AD4- 925-423-1062
+AD4- 
+AD4- 
+AD4- 
+AD4- 
+AD4- 
+AD4- On 1/3/14 1:00 PM, +ACI-Rolando Valdez+ACI- +ADw-rvaldezr+AEA-gmail.com+AD4- wrote:
+AD4- 
+AD4APg- Hi,
+AD4APg-
+AD4APg- I'm trying to represent data (unemployment rate) on a map.
+AD4APg-
+AD4APg- This is what I have:
+AD4APg-
+AD4APgA+- library(sp)
+AD4APgA+- library(maptools)
+AD4APg- Checking rgeos availability: TRUE
+AD4APgA+- map +ADw-- readShapeSpatial(+ACI-ESTADOS+ACI-)
+AD4APgA+- read.csv(+ACI-C:+AFwAXA-Users+AFwAXA-Rolando+AFwAXA-Documents+AFwAXA-Maestr+AO0-a en Econom+AO0-a+AFwAXA-3er
+AD4APgA+- Semestre+AFwAXA-AEMT+AFwAXA-desempleo+AF8-est.csv+ACI-)
+AD4APgA+- spplot(map, c(+ACI-2000+ACI-))
+AD4APg- Error en +AGAAWw-.data.frame+AGA-(obj+AEA-data, zcol) : undefined columns selected
+AD4APg-
+AD4APgA+- unem +ADw-- read.csv(+ACI-C:+AFwAXA-Users+AFwAXA-Rolando+AFwAXA-Documents+AFwAXA-Maestr+AO0-a en 
+AD4APgA+- Econom+AO0-a+AFwAXA-3er Semestre+AFwAXA-AEMT+AFwAXA-desempleo+AF8-est.csv+ACI-)
+AD4APgA+- names(unem)
+AD4APg- +AFs-1+AF0- +ACI-num+AF8-est+ACI- +ACI-est+ACI-     +ACI-X2000+ACI-   +ACI-X2005+ACI-   +ACI-X2010+ACI-   +ACI-X2013+ACI-
+AD4APg-
+AD4APg- I hope you can help me, this is my first time in R.
+AD4APg-
+AD4APg- Regards,
+AD4APg-
+AD4APg- Rol+AH4-
+AD4APg-
+AD4APg- +AF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXw-
+AD4APg- R-sig-Geo mailing list
+AD4APg- R-sig-Geo+AEA-r-project.org
+AD4APg- https://stat.ethz.ch/mailman/listinfo/r-sig-geo
+AD4- 
+AD4- 
+AD4- 
+AD4- +AF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXwBfAF8AXw-
+AD4- R-sig-Geo mailing list
+AD4- R-sig-Geo+AEA-r-project.org
+AD4- https://stat.ethz.ch/mailman/listinfo/r-sig-geo
+AD4- 

--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of M+APw-nster Heisenbergstra+AN8-e 2, 48149 M+APw-nster, Germany. Phone: +-49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795



More information about the R-sig-Geo mailing list