generate a matrix to show whether the item in each element of a list
Source:R/dataframe.R
exist_matrix.Rd
generate a matrix to show whether the item in each element of a list
Arguments
- x
list of character vectors
- n_lim
n limit to keep items in result
- n_top
only keep top n items in result
- sort_items
function to sort the items, item frequency by default
Examples
x <- 1:5 %>% purrr::map(
~ gen_char(to = "k", n = 5, random = TRUE, seed = .x)
)
exist_matrix(x)
#> # A tibble: 5 × 11
#> g i k a b c d e f h j
#> * <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl>
#> 1 TRUE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE FALSE FALSE
#> 2 FALSE FALSE FALSE TRUE FALSE FALSE FALSE TRUE TRUE TRUE FALSE
#> 3 TRUE FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE
#> 4 TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE
#> 5 FALSE TRUE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE