convertRowsToList {BBmisc}R Documentation

Convert rows (columns) of data.frame or matrix to lists.

Description

For 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) of x? Default is FALSE.

name.vector

[logical(1)]
Name vector elements in resulting list with names of cols (rows) of x? Default is FALSE.

factors.as.char

[logical(1)]
If x is a data.frame, convert factor columns to string elements in the resulting lists? Default is TRUE.

as.vector

[logical(1)]
If x is a matrix, store rows as vectors in the resulting list - or otherwise as lists? Default is TRUE.

Value

[list of lists or vectors].


[Package BBmisc version 1.13 Index]