Description Usage Arguments Value Examples
Aggregate into a JSON array
1 |
x |
Vector to collapse into JSON array. |
A json2
vector of length one with the elements of x
collapsed
to a JSON array.
1 2 3 4 5 6 7 8 9 10 11 12 | json_array_agg(1:3)
json_array_agg(json2(c('{"a": 1}', '{"b": 2}')))
# can be quite useful in combination with `dplyr::group_by()`
if (require("dplyr", quietly = TRUE, warn.conflicts = FALSE)) {
tibble::tibble(
group = c(1, 1, 2, 2),
json = c(1:4)
) %>%
dplyr::group_by(group) %>%
dplyr::summarise(json = json_array_agg(json))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.