strList2DataFrame: Format a string list into a data.frame

View source: R/writeStrList.R

strList2DataFrameR Documentation

Format a string list into a data.frame

Description

Format a string list into a data.frame

Usage

strList2DataFrame(strList, colnames = names(strList), index = FALSE)

Arguments

strList

A list of character strings. Other data types (e.g. factors) are converted to strings.

colnames

Column names of the resulting data.frame, by default the names of the list

index

Logical value, whether the row.names attribute of the data.frame should be integer indexes

Value

A character matrix with list elements as columns, padded with empty strings to equal length.

Examples

myList <- list("A"=LETTERS[3:5], "B"=LETTERS[4])
strList2DataFrame(myList)
strList2DataFrame(myList, colnames=c("FirstColumn", "SecondColumn"))
strList2DataFrame(myList, colnames=c("FirstColumn", "SecondColumn"), index=TRUE)

myFacList <- list("A"=gl(2,3, labels=LETTERS[1:2]), 
    "B"=gl(3,4, labels=LETTERS[1:3]))
strList2DataFrame(myFacList)

ribiosIO documentation built on Feb. 20, 2026, 5:09 p.m.