list2mat: Convert a one-level list into an adjacency matrix

View source: R/list2mat.R

list2matR Documentation

Convert a one-level list into an adjacency matrix

Description

First-level list must have vectors of basic data types defined by R such as characater, integer, number, and logical.The function transforms such a list into adjacency matrix, rows of which are vector elements and columns of which are names of the list.

Usage

list2mat(list)

Arguments

list

A one-level list. See details

Value

An adjacency matrix. Row and column names are defined by unique elements and list names, respectively.

Author(s)

Jitao David Zhang <jitao_david.zhang@roche.com>

Examples


testList <- list(HSV=c("Adler", "Westermann", "Jansen"), FCB=c("Robben",
"Jansen", "Neuer"), S04=c("Westermann", "Neuer"))
list2mat(testList)

testList2 <- list(c("A", "B", "C"), c("B", "C", "D"), c("D", "E", "F"))
list2mat(testList2)

testList3 <- list(Worker1=0:8L, Worker2=5:13L, Worker3=8:16L, Worker4=16:24L)
list2mat(testList3)


bedapub/ribiosGSEA documentation built on March 30, 2023, 3:26 p.m.