[R-sig-Geo] using rasterize SOLVED

Hodgess, Erin HodgessE at uhd.edu
Sat Dec 29 07:58:23 CET 2012


Sorry to cause trouble...I figured it out
________________________________________
From: r-sig-geo-bounces at r-project.org [r-sig-geo-bounces at r-project.org] on behalf of Hodgess, Erin
Sent: Saturday, December 29, 2012 12:29 AM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] using rasterize

Hello again:

I'm trying to rasterize a spatial points data frame and I seem to be missing something, as seen below:



> str(loc3)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
  ..@ data       :'data.frame':    477 obs. of  6 variables:
  .. ..$ ID      : num [1:477] 1 2 3 5 6 8 9 10 10 13 ...
  .. ..$ lonmin  : num [1:477] 141 112.9 -85.9 -106.6 -91.2 ...
  .. ..$ lonmax  : num [1:477] 153.6 159.1 -85.4 -93.5 -91 ...
  .. ..$ latmin  : num [1:477] -37.5 -54.8 38 25.8 30.4 ...
  .. ..$ latmax  : num [1:477] -28.16 -9.22 38.38 36.5 30.56 ...
  .. ..$ location: Factor w/ 275 levels "NSW","Australia",..: 1 2 3 5 6 8 9 10 10 13 ...
  ..@ coords.nrs : int [1:2] 3 2
  ..@ coords     : num [1:477, 1:2] -31.3 -25.3 38.3 32 30.5 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:2] "lat" "lon"
  ..@ bbox       : num [1:2, 1:2] -37.8 -159.6 62.3 175.3
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "lat" "lon"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
  .. .. ..@ projargs: chr NA
> rasterize(loc3,field=location,fun=count,na.rm=TRUE)
Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘rasterize’ for signature ‘"SpatialPointsDataFrame", "missing"’
>

Do you have any ideas, please?  Could it be that the proj4string is NA, do you think, please?

Thanks,
Erin



        [[alternative HTML version deleted]]




More information about the R-sig-Geo mailing list