descj {mojson} | R Documentation |
Provide descriptive information about the JSON list, such as the key frequency, the nesting information and the value distribution.
descj(dat, sep = "@")
dat |
|
sep |
|
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.
The up
data frame stores the upstream information about where the current key is nested.
And the down
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
.
list
. The descriptive result.
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