toJSON.jsonstat.collection: Convert JSON-stat collection into JSON

Description Usage Arguments Value Examples

View source: R/jsonstat.R

Description

Convert JSON-stat collection into JSON

Usage

1
2
## S3 method for class 'jsonstat.collection'
toJSON(x, auto_unbox = F)

Arguments

x

JSON-stat collection

auto_unbox

this flag marks atomic vectors in given list as a singleton, so it will not turn into an 'array' when encoded into JSON. FALSE by default.

Value

JSON output

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(jsonstat)
library(dplyr)

.plan <- compress_plan("place.of.birth", "geo", "Place of Birth") %>%
  dimension("age.group", "classification", "Age Group") %>%
  dimension("gender", "classification", "Gender") %>%
  dimension("year", "time", "Year") %>%
  dimension("province.of.residence", "geo", "Province of Residence") %>%
  dimension("concept", "metric", "Concept") %>%
  dimension("value", "value", "value")

.dataset <- as.dataset(galicia, .plan,
              label = paste("Population by province of residence,",
                            "place of birth, age, gender and year",
                            "in Galicia"),
              href = "https://github.com/zedoul/jsonstat")

.collection <- as.collection(.dataset, label = "Comparison",
                             href = "https://github.com/zedoul/jsonstat")

.jsonstat <- toJSON(.collection)

jsonstat documentation built on May 2, 2019, 11:18 a.m.