Notes: 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") by.states1(a1,b1) 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 <burbrink...@gmail.com> wrote: > Interesting solutions. Thanks guys! > > On Wed, May 27, 2015 at 9:27 AM, William Michels <w...@caa.columbia.edu> > wrote: ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.