Process heterogeneous batch data.
This function turns a list of data obtained from the Avant API in
heterogeneous format into a data.frame. Here, heterogeneous refers
to a list of lists with each element being of possibly different size,
but a complete named list of the data for that row.
heterogeneous_recombinator(dat, id = "id")
dat |
list. The list of lists to process. Each row is a named list with the names being variable names and the values being respective variable values. |
id |
character. Primary key, by default |
For example,
list(list(variable_one = 1, variable_two = 'a'),
list(variable_one = 2, variable_three = 1))
refers to a data set with three variables with two rows, the first variable
having c(1,2), the second c('a', NA), and the third c(NA, 1).
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.
the formatted data.frame
pre_dataframe <-
list(list(variable_one = 1, variable_two = 'a'),
list(variable_one = 2, variable_three = 1))
df <- heterogeneous_recombinator(pre_dataframe)
# 3 by 2 dataframe w/ c(1,2), c('a', NA), c(NA, 1) in the columns, respectively.Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.