[R] Matching Up Values
Steve Murray
smurray444 at hotmail.com
Thu Jul 17 22:42:31 CEST 2008
Dear all,
I have two files, both of similar formats. In column 1 are Latitude values (real numbers, e.g. -179.25), column 2 has Longitude values (also real numbers) and in one of the files, column 3 has Population Density values (integers); there is no column 3 in the other file.
However, the main difference between these two files is that one has fewer rows than the other. So what I'm looking to do is, 'pad out' the shorter file, by adding in the rows with those that are 'missing' from the longer file (ie. if a particular coordinate isn't present in the shorter file but is in the 'longer/master' file), and having 'zero' as its Population Density value (column C).
This should result in the shorter file becoming the same length as the initially longer file, and with each file having the same coordinate values (latitude and longitude on each line).
How would I do this in R?
Thanks for any help offered,
Steve
_________________________________________________________________
The John Lewis Clearance - save up to 50% with FREE delivery
More information about the R-help
mailing list