I have two dataframes of distance data (this is made up data to use as an example):
ed <- data.frame(Site=c(1,1,2,2),
session=c(1,2,1,2),
Lat=c(34.18985, 34.19263, 33.80374, 33.80405),
Long=c(-117,17417,-117.16799, -116.73119, -116.73084))
od <- data.frame(Site=c(3,3,4,4,3,3,3,4),
species=c('koala', 'hedgehog', 'koala', 'hedgehog','koala', 'hedgehog', 'koala', 'hedgehog'),
count=c(3,50,20,9,4,5,6,7),
session=c(1,2,1,2,1,1,2,2),
Lat=c(34.189, 34.1925, 33.80380, 33.80410,34.189, 34.1925, 33.80380, 33.80410),
Long=c(-117,1743,-117.16799, -116.73119, -116.731,-117,1743,-117.16799, -116.73119, -116.731))
Unfortunately, the data was collected using two methods at two different survey scales. I am trying to match them up into a new dataframe. I need to sum all the counts from ‘od’ within each session and species that are within 50m of a location in ‘ed’. That way I can have a dataframe for all of the ‘ed’ data that includes a column for ‘Total count’ for each of the two species (see below as an example of the dataframe I hope to end up with)
ed2 <- data.frame(Site=c(1,1,2,2),
session=c(1,2,1,2),
Lat=c(34.18985, 34.19263, 33.80374, 33.80405),
Long=c(-117,17417,-117.16799, -116.73119, -116.73084),
TotalKo = (ww,xx,yy,zz), # filled in from analysis
TotalHe = (aa,bb,cc,dd))# filled in from analysis
Thank you for your help