Pivot convo structure to have one list element per stub each containing a numeric vector with the level(s) at which that stub appears (as opposed to one list element per level with entries for each stub).

pivot_convo(convo, repeats_only = TRUE)

Arguments

convo

A convo object or list of stubs by level

repeats_only

Boolean. Whether to return only stubs which exist in multiple levels

Value

Named list with one element per stubs (of any level) containing a character vector of all levels at which that stub appears

Details

The main use case for this function is validating that stubs do not appear at multiple levels. For this reason, the argument repeats_only defaults to TRUE and only stubs existing in multiple levels are returned.

Examples

convo <- list(letters[1:3], letters[2:4], letters[3:6]) pivot_convo(convo)
#> $b #> [1] 1 2 #> #> $c #> [1] 1 2 3 #> #> $d #> [1] 2 3 #>
pivot_convo(convo, repeats_only = FALSE)
#> $a #> [1] 1 #> #> $b #> [1] 1 2 #> #> $c #> [1] 1 2 3 #> #> $d #> [1] 2 3 #> #> $e #> [1] 3 #> #> $f #> [1] 3 #>