Learn R Programming

recombinator (version 1.0.1)

recombinator: Turn nested lists into data.frames.

Description

A mini-utility package for turning nested lists into data.frames.

A recombinator attempts to convert a depth 2 nested list into a data.frame.

Usage

recombinator(dat, id = "id")

Arguments

dat

list. The list of lists to process. It can be in homogeneous or heterogeneous format (see the description).

id

character. Primary key, by default "id".

Value

the converted data.frame. If not a list, no changes will be performed.

Details

There are two supported formats.

  1. Homogeneous lists A list where the first list element is a character vector giving the names of the data.frame, and the subsequent list elements themselves lists of values.

  2. Heterogeneous lists A list where each element is a named list of values. In this format, plyr::rbind will be used to take the union of all names and impute the ones missing with NA values.