[R] Problem merging data frames and duplicates

William Michels wjm1 at caa.columbia.edu
Wed May 27 22:00:29 CEST 2015


1. You can get output for all states (alphabetically) by pre-merging
data with states.abb:

a1 <- merge(state.abb, x, by= 1, all.x=T)
b1 <- merge(state.abb, y, by= 1, all.x=T)
colnames(a1) <- c("state", "locus")
colnames(b1) <- c("state", "locus")

2. In my previous post (based on the very small test data given), it
seemed output could be arranged sequentially by row numbers, while
keeping states alphabetically arranged. This doesn't appear to be
possible in general. The larger example above is in state-alphabetical
order, but row numbers are not sequential.

Best, Bill

William Michels, Ph.D.

On Wed, May 27, 2015 at 6:42 AM, Frank Burbrink <burbrink666 at gmail.com> wrote:
> Interesting solutions. Thanks guys!
> On Wed, May 27, 2015 at 9:27 AM, William Michels <wjm1 at caa.columbia.edu>
> wrote:

More information about the R-help mailing list