Skip to contents

This function reshapes a list of named lists into a named list of lists, effectively performing a transpose operation. It is equivalent to `purrr::list_transpose()`, but implemented in base R with minimal code.

Usage

transpose.List(list)

Arguments

list

A list of named lists. Each sub-list must have the same names.

Value

A named list of lists, with outer and inner structure transposed.

Examples

if (FALSE) { # \dontrun{
x <- list(
    list(a = 1, b = 2),
    list(a = 3, b = 4)
)
transpose.List(x)
# Returns: list(a = list(1, 3), b = list(2, 4))
} # }