> On Jun 17, 2016, at 10:26 AM, Alice Domalik <adoma...@sfu.ca> wrote:
> 
> Hi List, 
> 
> I'm working with some bird tracking data, and to filter the data set, I need 
> to exclude points taken at the colony. 
> I would like to exclude coordinates from within a 500 meter radius of a point 
> centered on the colony. 
> However, as an R novice, I'm not sure how to accomplish this. 
> 
> My df looks like this: 
> 
> AnimalID Latitude Longitude Datetime 


Use the first argument of the "[" function to select rows that meet your 
requirement. I constructed values in hte unit square and select only items in 
hte corners by excluding values within 0.5 units of the center, (0.5,0.5)


dfrm <- data.frame(ID=1:100, lat=runif(100), long=runif(100), 
                   Datetime=as.POSIXct(runif(100)*10000,origin="1970-01-01") )
reduced <- dfrm[ (dfrm$lat - .5)^2+(dfrm$long-.5)^2 > .25 , ]
with( reduced, plot(lat,long) )

Attachment: Rplot.pdf
Description: Adobe PDF document


Probably should have plotted (long, lat), and it might have been more eser 
freindly to use subset instead of `[ logical-vector, ]`  but I think this 
demonstrates the essential steps.

-- 

David Winsemius
Alameda, CA, USA

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to