Skip to content
Prev 205419 / 398506 Next

R matching lat/lon pairs from two datasets?

Or if there is a requirement for speed or shorter more convenient syntax 
then there is a data.table join.
Basically setkey(data1,V1,V2) and setkey(data2,V1,V2),  then "data1[data2]" 
does the merge very quickly. You probably then want to do something with the 
merged data set,  which you just add in like this "data1[data2,<something>]" 
or like this "data1[data2][,<something>]".  The columns in the key need to 
be either integers, or factors (which are internally integer),  so it would 
be a bit of extra work in this case to store the lat/lon as integer, if 
multiplying by 100 is ok.  Another option for you anyway.

"jim holtman" <jholtman at gmail.com> wrote in message 
news:644e1f321001041828n2f2a160etd597ba7a8bf76ad6 at mail.gmail.com...