similar_permutations: find the distinct _permutations_ of columns

View source: R/similar_permutations.R

similar_permutationsR Documentation

find the distinct permutations of columns

Description

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

Usage

similar_permutations(edges, to, from)

Arguments

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.

Details

The inputs can be anything that casn be input into the paste function.

Value

The inputs pasted together as a character string.

experimant first if it helps

not well supported

on multiple data types

Note

ensure the total values to fold are sufficiently low tp preserve the pretty print aesthetic

Examples

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)

aarong1/RshinyHelpers documentation built on June 15, 2022, 4:52 a.m.