John Mount shows off the match_order
function in wrapr:
Often we wish to work with such data aligned so each row in
d2
has the sameidx
value as the same row (by row order) asd1
. This is an important data wrangling task, so there are many ways to achieve it in R, such asbase::merge()
,dplyr::left_join()
, or by sorting both tables into the same order and then usingbase::cbind()
.However if you wish to preserve the order of the first table (which may not be sorted), you need one more trick.
Click through to see that one additional trick.