Skip to contents

Chop Vector by Group

Usage

gchop(v, g)

Arguments

v

<character> vector

g

<integer> group

Value

<list>

See also

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"
#>