descj {mojson} | R Documentation |
JSON Description
Description
Provide descriptive information about the JSON list, such as the key frequency, the nesting information and the value distribution.
Usage
descj(dat, sep = "@")
Arguments
dat |
|
sep |
|
Details
The result contains three parts:
key_summary
, presents the description of keys, which contains all the keys and their respective frequencies.value_summary
, presents the description of values, which contains all atomic values and their respective frequencies.stream_summary
, presents the description of paths' direct upstream keys and downstream keys. Theup
data frame stores the upstream information about where the current key is nested. And thedown
data frame stores the downstream information about how the current key branches. It means no upstream or downstream if.
value is empty.
Note that the mathematical logic of frequency is based on the flattening work, which means the occurrence of one key will be considered as repeated if it has multiple downstream keys.
For example, list(list(x = list(m = 1, n = 2), y = 2))
, and the frequency of x
will be 2, because it has two nesting keys.
It is recommended to interpret the upstream and downstream information in a relative way rather than an absolute way.
Returning the absolute frequency is to preserve the raw information.
Hence, it is easy to know that x
will equally branches to m
and n
.
Value
list
. The descriptive result.
See Also
Examples
library(mojson)
j <- list(a = list(x = 1, y = 2),
b = c(3, 4, list(z = 5, s = 6, t = list(m = 7, n = 8))))
j_multi <- list(j, j, j)
desc <- descj(j_multi)
desc$keys_summary