Skip to contents

Sub-split a split vector (Internal)

Usage

sub_split_vector(icolsplit, max_size = 4, ...)

Arguments

icolsplit

numeric vector used to split another vector

max_size

numeric max number of identical values permitted in icolsplit.

...

additional arguments are ignored

Value

factor vector suitable to use for splitting a vector into subsets, in order.

Details

This function is used to support contrasts_to_venn_setlists() in order to limit the number of Venn sets included by subgroup. This function adds another level of splitting, while keeping the elements in the original order after splitting.

Examples

icolsplit <- rep(c(1, 2, 3), c(6, 5, 4))
newsplit <- sub_split_vector(icolsplit)
split(icolsplit, newsplit)
#> $`1.1`
#> [1] 1 1 1 1
#> 
#> $`1.2`
#> [1] 1 1
#> 
#> $`2.1`
#> [1] 2 2 2
#> 
#> $`2.2`
#> [1] 2 2
#> 
#> $`3`
#> [1] 3 3 3 3
#> 

newsplit3 <- sub_split_vector(icolsplit, max_size=3)
split(icolsplit, newsplit3)
#> $`1.1`
#> [1] 1 1 1
#> 
#> $`1.2`
#> [1] 1 1 1
#> 
#> $`2.1`
#> [1] 2 2 2
#> 
#> $`2.2`
#> [1] 2 2
#> 
#> $`3.1`
#> [1] 3 3
#> 
#> $`3.2`
#> [1] 3 3
#>