homogeneous_recombinator: Process homogeneous batch data.

Description Usage Arguments Details Value Examples

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

1
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".

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.

Value

the formatted data.frame

Examples

1
2
3
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.

recombinator documentation built on May 2, 2019, 9:39 a.m.