[R-sig-Geo] Represent data on map

MacQueen, Don macqueen1 at llnl.gov
Sat Jan 4 00:06:33 CET 2014


Cannot help much without more information, but try:

  names(map)

Then pick one of the column names. Apparently, "2000" is not the name of a
column of data in the map object.
If map is like unem, then perhaps

  spplot(map, 'X2000')

is what you need.

Note, the c() in
  c("2000")
is not necessary. Simply
  "2000"
would be sufficient.

I am not familiar with the readShapeSpatial function; I always use
readOGR() from the sp package.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 1/3/14 1:00 PM, "Rolando Valdez" <rvaldezr at gmail.com> wrote:

>Hi,
>
>I'm trying to represent data (unemployment rate) on a map.
>
>This is what I have:
>
>> library(sp)
>> library(maptools)
>Checking rgeos availability: TRUE
>> map <- readShapeSpatial("ESTADOS")
>> read.csv("C:\\Users\\Rolando\\Documents\\Maestría en Economía\\3er
>>Semestre\\AEMT\\desempleo_est.csv")
>> spplot(map, c("2000"))
>Error en `[.data.frame`(obj at data, zcol) : undefined columns selected
>
>> unem <- read.csv("C:\\Users\\Rolando\\Documents\\Maestría en
>>Economía\\3er Semestre\\AEMT\\desempleo_est.csv")
>> names(unem)
>[1] "num_est" "est"     "X2000"   "X2005"   "X2010"   "X2013"
>
>I hope you can help me, this is my first time in R.
>
>Regards,
>
>Rol~
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list