Learn R Programming

BBmisc (version 1.10)

convertListOfRowsToDataFrame: Convert a list of row-vectors of equal structure to a data.frame.

Description

Elements are arranged in columns according to their name in each element of rows. Missing values are filled using NAs.

Usage

convertListOfRowsToDataFrame(rows, strings.as.factors = default.stringsAsFactors(), row.names, col.names)

Arguments

rows
[list] List of rows. Each row is a list or vector of the same structure. That means all rows must have the same length and all corresponding elements must have the same class.
strings.as.factors
[logical(1)] Convert character columns to factors? Default is default.stringsAsFactors().
row.names
[character | integer | NULL] Row names for result. By default the names of the list rows are taken.
col.names
[character | integer] Column names for result. By default the names of an element of rows are taken.

Value

[data.frame].

Examples

Run this code
convertListOfRowsToDataFrame(list(list(x = 1, y = "a"), list(x = 2, y = "b")))

Run the code above in your browser using DataLab