recombinator {recombinator} | R Documentation |
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 |
Details
There are two supported formats.
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.
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 withNA
values.
Value
the converted data.frame. If not a list, no changes will be performed.
Note
A warning will be issued if non-standard names (i.e. those containing more than alphanumeric, underscore, and period characters) are used.