Roger.Bivand at nhh.no
Tue Dec 7 10:17:18 CET 2010
On Mon, 6 Dec 2010, Agnieszka Kaczmarczyk wrote:
> I make grids and Object of class SpatialPixels not are atrributes?
>> alu <- read.csv("cooral.csv", header = TRUE, sep = ",")
>> coordinates(alu) = ~x+y
>> attributes(alu) = al
> Error: object 'al' not found
You have two problems - one that assigning through attributes() is
absolutely wrong - it assigns to arbitrary old-style class attributes:
m <- "whatever"
attributes(m) <- list(class="rubbish")
and the second is that there is no object called "al" in your workspace.
It probably doesn't matter, though, as here:
>> alu.sp = spsample(alu, type = "regular", cellsize = c(50,50))
>> gridded(alu.sp) = TRUE
you are creating a SpatialPixels object covering the input point data.
Ask your question again using the built-in meuse data set, please, and
try to let us know what you are trying to do.
> Object of class SpatialPixels
> min max
> x1 4384052 4393102
> x2 5569919 5579319
> Is projected: NA
> proj4string : [NA]
> Number of points: 34028
> Grid attributes:
> cellcentre.offset cellsize cells.dim
> x1 4384077 50 181
> x2 5569944 50 188
>> # promote to SpatialPixelsDataFrame
>> gridded(alu.sp) <- TRUE
>> # creates the full grid
>> alu.sg = as(alu.sp, "SpatialGridDataFrame")
> Error in .subset2(x, i, exact = exact) : subscript out of bounds
> Error in summary(object at data[]) :
> error in evaluating the argument 'object' in selecting a method for
> function 'summary'
>  "SpatialGridDataFrame"
>  "sp"
> [[alternative HTML version deleted]]
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo