View source: R/similar_permutations.R
similar_permutations | R Documentation |
find the distinct permutations of columns, particularly in graph applications were describing relationships between unordered nodes, or other applications were the order does not matter
similar_permutations(edges, to, from)
edges |
dataframe, tibble, The data structure to work on |
to |
tidy-eval, character The variable to group by |
from |
The column of values that will collapse into a list. |
The inputs can be anything that casn be input into the paste function.
The inputs pasted together as a character string.
on multiple data types
ensure the total values to fold are sufficiently low tp preserve the pretty print aesthetic
if(!require(dplyr)){library(dplyr)} edges <- data.frame( to=sample(c('A','B','C','D'),size = 50,replace=TRUE), from=sample(c('A','B','C','D','E','F'),size = 50,replace=TRUE)) dplyr::count(edges,to,from) ordered = similar_permutations(edges,to,from) dplyr::count(ordered, to ,from)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.