Skip to content
Prev 274365 / 398506 Next

getting data associated with coordinates in a spatial data frame

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.


-----Original Message-----
From: Sarah Goslee [mailto:sarah.goslee at gmail.com] 
Sent: Wednesday, October 12, 2011 5:34 PM
To: Bailey, Daniel
Cc: r-help at r-project.org
Subject: Re: [R] getting data associated with coordinates in a spatial data frame

Hi,
On Wed, Oct 12, 2011 at 3:37 PM, Bailey, Daniel <bailed at spu.edu> wrote:
That's kind of mangled, but what about:

e[e$x == my.x & e$y == my.y, "leachate"]

(Depending on the form of your coordinates, you may also have to invoke FAQ 7.31.)

Sarah
--
Sarah Goslee
http://www.functionaldiversity.org