recombinator (version 1.0.1)

homogeneous_recombinator: Process homogeneous batch data.

Description

This function turns a list of data obtained from the Avant API in homogeneous format into a data.frame. Here, homogeneous refers to a list of lists with the first element of the list being a character vector of column names, and subsequent list elements being lists of values in the correct order and of the same length as the names vector.

Usage

homogeneous_recombinator(dat, id = "id")

Arguments

dat

list. The list of lists to process. The first list element is a character vector of variable names, and subsequent elements are lists of variable values ordered by these variable names.

id

character. Primary key, by default "id".

Value

the formatted data.frame

Details

For example, list(c('variable_one', 'variable_two'), list(1, 'a'), list(2, 'b')) refers to a data set with two variables with two rows, the first variable having c(1,2) and the latter having 'a', 'b'.

If the list of lists is not formatted in this way, the function performs no error handling and will likely return a malformed data.frame.

Examples

Run this code
# NOT RUN {
pre_dataframe <- list(c('variable_one', 'variable_two'), list(1, 'a'), list(2, 'b'))
df <- homogeneous_recombinator(pre_dataframe)
# 2 by 2 dataframe w/ c(1,2), c('a','b') in the columns, respectively.
# }

Run the code above in your browser using DataLab