Convert rows (columns) of data.frame or matrix to lists
Source:R/convertRowsToList.R
convertRowsToList.RdFor each row, one list/vector is constructed, each entry of the row becomes a list/vector element.
Usage
convertRowsToList(
x,
name.list = TRUE,
name.vector = FALSE,
factors.as.char = TRUE,
as.vector = TRUE
)
convertColsToList(
x,
name.list = FALSE,
name.vector = FALSE,
factors.as.char = TRUE,
as.vector = TRUE
)Arguments
- x
[
matrix|data.frame]
Object to convert.- name.list
[
logical(1)]
Name resulting list with names of rows (cols) ofx? Default isFALSE.- name.vector
[
logical(1)]
Name vector elements in resulting list with names of cols (rows) ofx? Default isFALSE.- factors.as.char
[
logical(1)]
Ifxis a data.frame, convert factor columns to string elements in the resulting lists? Default isTRUE.- as.vector
[
logical(1)]
Ifxis a matrix, store rows as vectors in the resulting list - or otherwise as lists? Default isTRUE.