I have multiple data frames for data collected over 4 days. Each of the data frames looks like this (put very simply):
Lat Long PM
-33.9174 151.2263 8
-33.9175 151.2264 10
-33.9176 151.2265 9
-33.9177 151.2266 8
I want to merge multiple data frames based on their matching Long and Lat values, to average out all 'PM' values at a particular location. The end result will look something like this (for the 13th - 16th Feb):
Lat Long PM.13th Feb PM.14th Feb PM.15th Feb **Mean**
-33.9174 151.2263 8 9 11 9.33
-33.9175 151.2264 10 11 12 11
-33.9176 151.2265 9 14 13 12
-33.9177 151.2266 8 10 11 9.66
I understand that merging 2 data frames is easy enough:
df = merge(data1, data2, by.x = c("Lat", "Long"), by.y = c("Lat", "Long"))
But how do I merge multiple dataframes based on matching Longitude and Latitude values?
Also, is there a way I can filter the data so that it will match up data which is within 0.001 Lat/Long value of each other? (Currently I am rounding the Lat/Long data to 3 decimal places, but it is duplicating my data).