Given a vector of integers, create a list of indexed vectors.

listify(indices)

Arguments

indices

a vector of integers indicating the length of each vector in the produced list

Value

A list of index vectors

Author

Gaston Sanchez

See also

Examples

# let's say you have a vector of indices list like this
number_elements = c(3, 1, 5)

# get list of index vectors based on 'number_elements'
listify(number_elements)
#> [[1]]
#> [1] 1 1 1
#> 
#> [[2]]
#> [1] 2
#> 
#> [[3]]
#> [1] 3 3 3 3 3
#>