listify: Create a list from a vector of integers

Description Usage Arguments Value Author(s) See Also Examples

View source: R/listify.r

Description

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

Usage

1
  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(s)

Gaston Sanchez

See Also

indexify

Examples

1
2
3
4
5
# 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)

Example output

Attaching package: 'turner'

The following object is masked from 'package:base':

    lengths

[[1]]
[1] 1 1 1

[[2]]
[1] 2

[[3]]
[1] 3 3 3 3 3

turner documentation built on May 2, 2019, 8:35 a.m.