Chop Vector by Group
See also
Other tidyverse:
columns_to_character()
,
glue_chr()
,
glue_data_chr()
,
named_group_split()
,
search_for()
Examples
(v <- c("222", "280", "3020", "8690", "G0294", "G8126"))
#> [1] "222" "280" "3020" "8690" "G0294" "G8126"
(g <- sample(1:2, size = length(v), replace = TRUE))
#> [1] 1 2 1 1 1 2
gchop(v, g)
#> [[1]]
#> [1] "222"
#>
#> [[2]]
#> [1] "280"
#>
#> [[3]]
#> [1] "3020" "8690" "G0294"
#>
#> [[4]]
#> [1] "G8126"
#>