[R] Calculate Distance and Aggregate Data?
Jim Lemon
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:
http://www.census.gov/cgi-bin/geo/gisfaq?Q5.1
for the spherical approximation and various corrections to account for the
earth's departure from sphericity.
Jim
More information about the R-help
mailing list