numerate {comprehenr}R Documentation

Auxiliary functions for working with lists

Description

Usage

numerate(x)

enumerate(x)

unnumerate(x, item = 2)

mark(x)

unmark(x, item = 2)

unzip_list(x)

zip_lists(...)

lag_list(x)

Arguments

x

list, vector or list of lists

item

numeric number of list in which stored values

...

lists which will be zipped

Value

list or list of lists

Examples

cities = c('Chicago', 'Detroit', 'Atlanta')
airports = c('ORD', 'DTW', 'ATL')
pairs = zip_lists(cities, airports)

str(pairs)
str(unzip_list(pairs))

str(numerate(cities))

named_list = c('Chicago' = 'ORD', 'Detroit' = 'DTW', 'Atlanta' = 'ATL')
str(mark(named_list))

set.seed(123)
rand_sequence = runif(20)
# gives only locally increasing values
to_vec(for(`i, j` in lag_list(rand_sequence)) if(j>i) j)

[Package comprehenr version 0.6.10 Index]