View source: R/json_unnest_longer.R
json_unnest_longer | R Documentation |
Unnest a column of JSON arrays in a data frame producing a longer data frame.
json_unnest_longer(
data,
col,
values_to = NULL,
row_numbers_to = NULL,
indices_to = NULL,
ptype = NULL,
wrap_scalars = FALSE,
bigint_as_char = bigint_default()
)
data |
A data frame. |
col |
JSON-column of arrays to extract components from. |
values_to |
Name of column to store vector values. Defaults to |
row_numbers_to |
Name of column to store the row number before unnesting. |
indices_to |
Name of column to store the array index of each element; note that this starts with 0. |
ptype |
Output type. If |
wrap_scalars |
Should scalar values be wrapped? Note that scalars are only wrapped if either
|
bigint_as_char |
Convert big integers to character? The option
|
A data frame, or subclass of data frame.
json_unnest_wider()
df <- tibble::tibble(
x = c("a", "b"),
json = c("[1, 2]", "[3, 4, 5]")
)
df
df %>%
json_unnest_longer(
"json",
row_numbers_to = "id",
indices_to = "index"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.