Description Usage Arguments Value Examples

Build a permutation p such that ids1[p] == ids2. See http://www.win-vector.com/blog/2017/09/permutation-theory-in-action/.

1 | ```
match_order(ids1, ids2)
``` |

`ids1` |
unique vector of ids. |

`ids2` |
unique vector of ids with sort(ids1)==sort(ids2). |

p integers such that ids1[p] == ids2

1 2 3 4 5 6 | ```
ids1 <- c(4, 5, 7, 8, 9, 6, 1, 3, 2, 10)
ids2 <- c(3, 6, 4, 8, 5, 7, 1, 9,10, 2)
p <- match_order(ids1, ids2)
ids1[p]
all.equal(ids1[p], ids2)
# note base::match(ids2, ids1) also solves this problem
``` |

WinVector/wrapr documentation built on Jan. 12, 2019, 7:40 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.