invertList: Invert a 2-level list

Description Usage Arguments Value Examples

View source: R/helpers.R

Description

This is a simple version of purrr::transpose, only for lists with 2 levels.

Usage

1

Arguments

l

A list with 2 levels. If some levels are absent, they will be NULL

Value

A list with 2 levels deep, inverted from l

Examples

1
2
3
# create a 2-deep, 2 levels in first, 3 levels in second
a <- list(a = list(d = 1, e = 2:3, f = 4:6), b = list(d = 5, e = 55))
invertList(a) # creates 2-deep, now 3 levels outer --> 2 levels inner

Require documentation built on May 31, 2021, 9:07 a.m.