I have a nested list which have received from a REST call. The response includes a nested set of lists from an underlying relational database. I want to flatten the list to simplify analysis. I have tried to follow the guidelines in the purrr tutorial but I can't get it to work.
My simplified input
hist1 <- list(field="type", from_string ="issue", to_string="bug")
hist2 <- list(field="status", from_string ="open", to_string="closed")
hist3 <- list(field="type", from_string ="bug", to_string="issue")
issue1 <- list(id="123", created = "2017-11-08", issue_history = list(hist1, hist2))
issue2 <- list(id="124", created = "2017-11-10", issue_history = list(hist1, hist3))
issue <- list(issue1, issue2)
I am looking for an flattened output:
id created type from_string to_string
123 2017-11-08 type issue bug
123 2017-11-08 status open closed
123 2017-11-10 type bug issue
Which is the best way of building scable logic for this?
Best (for me):
- tools from tidyverse
- code that is simple to maintain
- do not have to scale for millions of issues, i.e. performance and memory are not critical elements