Skip to contents

This function combines multiple vectors or lists element-wise into a list of lists. It's a slightly lighter weight alternative to itertools::izip()

Usage

zipit(...)

Arguments

...

Vectors or lists to be combined.

Value

A list of lists, where each inner list contains the elements from the corresponding positions in the input vectors or lists.

See also

Examples

# Zip two vectors
zipit(c(1, 2, 3), c("a", "b", "c"))
#> [[1]]
#> [[1]][[1]]
#> [1] 1
#> 
#> [[1]][[2]]
#> [1] "a"
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#> [1] 2
#> 
#> [[2]][[2]]
#> [1] "b"
#> 
#> 
#> [[3]]
#> [[3]][[1]]
#> [1] 3
#> 
#> [[3]][[2]]
#> [1] "c"
#> 
#> 
# Zip three vectors
zipit(c(1, 2), c("x", "y"), c(TRUE, FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 1
#> 
#> [[1]][[2]]
#> [1] "x"
#> 
#> [[1]][[3]]
#> [1] TRUE
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#> [1] 2
#> 
#> [[2]][[2]]
#> [1] "y"
#> 
#> [[2]][[3]]
#> [1] FALSE
#> 
#>