[R] Calculate Distance and Aggregate Data?
bitwrit at ozemail.com.au
Wed Feb 25 08:00:11 CET 2004
dsheuman at rogers.com wrote:
> Hi all,
> I've been struggling learning R and need to turn to the list again.
> I've got a dataset (comma-delimited file) with the following fields:
> recid, latitude, longitude, population, dwelling and age. For each
> observation, I'd like to calculate the total number of people and dwellings
> and average age within 2 k.m. Distance could be Euclidean, however, a
> proper distance calculation (great circle route) is best.
A good approximation is the haversine formula, see:
for the spherical approximation and various corrections to account for the
earth's departure from sphericity.
More information about the R-help