Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

convertListOfRowsToDataFrame

Convert a list of row-vector of equal structure to a data.frame.


Description

Elements are arranged in columns according to their name in each element of rows. Variables that are not present in some row-lists, or encoded as NULL, 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, where all corresponding elements must have the same class. It is allowed that in some rows some elements are not present, see above.

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

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

BBmisc

Miscellaneous Helper Functions for B. Bischl

v1.11
BSD_2_clause + file LICENSE
Authors
Bernd Bischl [aut, cre], Michel Lang [aut], Jakob Bossek [aut], Daniel Horn [aut], Jakob Richter [aut], Dirk Surmann [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.