Hello everyone, Thank you in advance for any help; my apologies for the basic nature of my question.
Here goes...I have three vectors, one with my data, and the other two with the integer x coordinates and integer y coordinates of the data. Put together theoretically, they form a sparse sampling of a 250x250 point grid. For example, a sample would be a data value of "1100" located at "121,34" where 1100, 121, and 34 are the i-th values in each of the three vectors. For comparison, I have a fully filled 250x250 grid (62500 data points), in the same three-vector format. When I make a SpatialPixelsDataFrame object with the -full- 62500 data points, eg > full.frame <- data.frame(z = full.data, x.coord, y.coord) > coordinates(full.frame) <- c("x.coord", "y.coord") > gridded(full.frame) <- TRUE .....then summary(full.frame) gives: cellcentre.offset cellsize cells.dim x.coord 1 1 250 y.coord 1 1 250 ...as desired. Yay! But when I do the same thing building a data.frame with the three 'sparse' data vectors (all three vectors have length of 129, which is the number of samples, which is << 62500): > sparse.frame <- data.frame(z = sparse.data, x.sparse.coord, y.sparse.coord) > coordinates(sparse.frame) <- c("x.sparse.coord", "y.sparse.coord") > gridded(sparse.frame) <- TRUE .....summary(sparse.frame) gives: cellcentre.offset cellsize cells.dim x.sparse.coord 0 3.387097 75 y.sparse.coord 2 3.240000 77 Which is not desired, they should be 1,1,and 250 as above, right? Additionally, when forming sparse.frame I get the following: Warning messages: 1: grid has empty column/rows in dimension 1 in: points2grid(points, tolerance) 2: grid has empty column/rows in dimension 2 in: points2grid(points, tolerance) I would like to be able to perform various functions (eg a variogram) on the sparse samples, but such functionality requires square cells. So, after extensively trying to use the SpatialGridDataFrame class instead of the SpatialPixelsDataFrame one and bbox and so on, I'm coming up short with a way to do something like: > gridparameters(sample.frame)$cellsize[1] <- 1 Which doesn't work. In short, how can I force the sparse samples to be a given unit square width? Thank you very much for your time, Cora [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo