| is_json | R Documentation |
tbl_json objectsThese functions are often useful with filter to
filter complex JSON by type before applying gather_object or
gather_array.
is_json_string(.x) is_json_number(.x) is_json_logical(.x) is_json_null(.x) is_json_array(.x) is_json_object(.x) is_json_scalar(.x)
.x |
a json string or |
a logical vector
json_types for creating a new column to identify the
type of every JSON document
# Test a simple example
json <- '[1, "string", true, [1, 2], {"name": "value"}, null]' %>% gather_array
json %>% is_json_number
json %>% is_json_array
json %>% is_json_scalar
# Use with filter
library(dplyr)
json %>% filter(is_json_object(.))
# Combine with filter in advance of using gather_array
companies[1:5] %>% gather_object %>% filter(is_json_array(.))
companies[1:5] %>% gather_object %>% filter(is_json_array(.)) %>%
gather_array
# Combine with filter in advance of using gather_object
companies[1:5] %>% gather_object %>% filter(is_json_object(.))
companies[1:5] %>% gather_object %>% filter(is_json_object(.)) %>%
gather_object("name2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.