reverse_split: A Function To Reverse The Role Of Names And Values In A List.

Description Usage Arguments Details Value Note See Also Examples

Description

Given a list with names 'x' and values in a set 'y' this function returns a list with names in 'y' and values in 'x'.

Usage

1

Arguments

lst

list: A named list with values that are vectors.

Details

First the list is unrolled to provide a two long vectors, names are repeated, once for each of their values. Then the names are split by the values. This turns out to be useful for inverting mappings between one set of identifiers and an other.

Value

list: A list with length equal to the number of distinct values in the input list and values from the names of the input list.

Note

This function is taken from the Biobase package

See Also

split

Examples

1
2
l1 = list(a=1:4, b=c(2,3), d=c(4,5))
reverse_split(l1)

biodatacore/biodatacoreUtils documentation built on May 28, 2019, 7:11 p.m.