Displaying 1 result from an estimated 1 matches for "lonlat2".
Did you mean:
lonlat
2004 Feb 26
1
Distance and Aggregate Data - Again...
...llowing fields: recid, sum(pop), sum(dwell),
mean(age). I don't know how to write only those fields out to the
file.
Any suggestions?
Thank you for your help,
Danny
#####
library(fields)
d <- as.matrix( read.csv("filein.csv") )
for(i in 1:nrow(d)){
lonlat1 <- d[i,2:3]
lonlat2 <- d[,2:3]
distval <- d[,1] [which(rdist.earth( t( as.matrix(lonlat1) ),
as.matrix(lonlat2), miles=F ) < 2)]
write(distval,file="C:\\outfile.out",ncol=1, append=TRUE)
}
#####
--------------
Sample Input Data
--------------
recid,lat,long,pop,dwell,age
10010265,47.5971174,-52....