# Stack names
'{"first": "bob", "last": "jones"}' %>%
gather_object %>%
append_values_string
# This is most useful when data is stored in name-value pairs
# For example, tags in recipes:
recipes <- c('{"name": "pie", "tags": {"apple": 10, "pie": 2, "flour": 5}}',
'{"name": "cookie", "tags": {"chocolate": 2, "cookie": 1}}')
recipes %>%
spread_values(name = jstring(name)) %>%
enter_object(tags) %>%
gather_object("tag") %>%
append_values_number("count")
Run the code above in your browser using DataLab