Hi, On Thu, Oct 13, 2011 at 2:05 PM, Bailey, Daniel <bai...@spu.edu> wrote: > Thank you Sarah. I tried your suggestion, and if I coerce it into a normal > data.frame, that method works. But if you've already made the data into a > SpatialPixelsDataFrame and run coordinates (both from the package "sp") so > that the columns "x" and "y" become a single column "coordinates" with the > format (0, 17) for x and y, how do you then call or manipulate data at a > specific location? > > The following: > e[e$coordinates==(0,17),] > Doesn't work.
They "don't become a single column" but rather a single matrix with two columns, and (0, 17) isn't the correct way to specify a vector. You can identify particular coordinates using the form I offered earlier, and then use that to subset the data slot of your SGPF. Using built-in data: library(sp) data(meuse.grid) m = SpatialPixelsDataFrame(points = meuse.grid[c("x", "y")], data = meuse.grid) m@data[coordinates(m)[,"x"] == 181100 & coordinates(m)[,"y"] == 333660,] There ought to be a more elegant way to match coordinates (other than the do.call() and paste() approach), but I'm not sure what it is. Sarah -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.