sst_lists_to_df: Convert list of lists to data.frame

Description Usage Arguments Value Examples

View source: R/utility_functions.R

Description

API response might contain nested lists with different number of elements. This function fills missing elements and combine lists to a data.frame.

Usage

1
sst_lists_to_df(lists, fill = NA)

Arguments

lists

- a list of nested lists with different number of elements

fill

- a value to fill missing values in lists

Value

A data.frame with all missing values filed with specified value.

Examples

1
2
3
4
5
6
7
sst_lists_to_df(
  lists = list(
    first_list  = list(a = 1, b = 2),
    second_list = list(a = 2, c = 3)
  ),
  fill  = 'empty'
)

Example output

  a     b     c
1 1     2 empty
2 2 empty     3

serpstatr documentation built on Jan. 11, 2021, 1:36 a.m.