Generate all combinations of the elements of a character vector

combn_char(x)

Arguments

x

a character vector

Value

a nested list. A list whose elements are lists containing the character vectors with the combinations of their elements.

Examples

combn_char(c("gender", "sector"))
#> [[1]]
#> [[1]][[1]]
#> [1] "gender" "sector"
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#> [1] "gender"
#> 
#> [[2]][[2]]
#> [1] "sector"
#> 
#> 
combn_char(c("gender", "sector", "education"))
#> [[1]]
#> [[1]][[1]]
#> [1] "gender"    "sector"    "education"
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#> [1] "gender" "sector"
#> 
#> [[2]][[2]]
#> [1] "gender"    "education"
#> 
#> [[2]][[3]]
#> [1] "sector"    "education"
#> 
#> 
#> [[3]]
#> [[3]][[1]]
#> [1] "gender"
#> 
#> [[3]][[2]]
#> [1] "sector"
#> 
#> [[3]][[3]]
#> [1] "education"
#> 
#>