spread function in
tidyr but for JSON,
this function spreads out any JSON objects that are scalars into new columns.
If objects are nested, then the recursive flag will expand scalar values of
nested objects out with a compound column name based on the sequences of
nested object names concatenated with the
a json string or
whether or not to recursively spread nested objects
character used to separate nested object names when resursive
Note that arrays are ignored by this function, use
to gather the array first, and then use
spread_all if the array
contains objects or use one of the
append_values functions to
capture the array values if they are scalars.
Note that scalar JSON values (e.g., a JSON string like '1') are also ignored, as they have no names to create column names with.
The order of columns is determined by the order they are encountered in the JSON document, with nested objects placed at the end.
If an objects have name-value pairs with names that are duplicates, then
".n" is appended for n incrementing from 2 on to ensure that columns
are unique. This also happens if
.x already has a column with the
name of a name-value pair.
This function does not change the value of the JSON attribute of the
tbl_json object in any way.
1 2 3 4 5 6 7 8 9 10 11 12
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.