create_config: Function for creating chart configurations.

Description Usage Arguments Source Examples

View source: R/create_config.R

Description

create_config creates configuration lists using

create_query_url to build the SDMX query URLs

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  create_config(sdmx_data_query = stop("'sdmx_data_query' must be specified"),
  data_api_endpoint = "https://stats.oecd.org/SDMX-JSON/data",
  path = NULL, title = NULL, subtitle = NULL, source_url = NULL,
  source_label = NULL, highlight = NULL, baseline = NULL,
  chart_dimension = NULL, display = "label", width = NULL,
  height = NULL, x_axis = NULL, y_axis = NULL, logo = TRUE,
  owner = TRUE, language = "en",
  type = stop("'type' must be specified"))


  create_query_url(sdmx_data_query = stop("'sdmx_data_query' must be provided"),
  data_api_endpoint = stop("'data_api_endpoint' must be provided"))

Arguments

sdmx_data_query

complete SDMX URL, e.g. ""KEI/PRINTO01+PRMNTO01.AUS+AUT+BEL+CAN+CHL+CZE+DNK+EST+FIN+FRA.GP.A/all?startTime=2015&endTime=2015"

data_api_endpoint

SDMX API URL, e.g. http://stats.oecd.org/SDMX-JSON/data

path

path to a JSON template that can be read using jsonlite::fromJSON

title

character string main title of chart

subtitle

character vector chart subtitle

source_url

character string to add URL below chart

source_label

character string to show instead of URL below chart

highlight

a list of character vectors respecting the order of dimensions of the SDMX data flow

baseline

a list of character vectors respecting the order of dimensions of the SDMX data flow

chart_dimension

list of id, x, y and mode

width

integer chart width in pixel

height

integer chart height in pixel

logo

logical include logo

owner

logical include copyright information

language

character string, one of en or fr

type

one of BarChart, RowChart, ScatterChart, HSymbolChart, VSymbolChart, TimelineChart, StackedBarChart

Source

jsonlite was created by Jeroen Ooms et al., see https://cran.r-project.org/web/packages/jsonlite/index.html.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
query <- "KEI/PRINTO01+PRMNTO01.AUS+AUT+BEL+CAN+CHL+CZE+DNK+EST+FIN+FRA.GP.A/all?startTime=2015&endTime=2015"
chartconfig <- create_config(sdmx_data_query = query, type = "BarChart")
str(chartconfig)

## using custom template
jsonfile <- system.file("templates/default.json", package = "rcw")
chartconfig2 <- create_config(sdmx_data_query = query, type = "BarChart", path = jsonfile)
str(chartconfig2)

query <- "KEI/PRINTO01+PRMNTO01.AUS+AUT+BEL+CAN+CHL+CZE+DNK+EST+FIN+FRA.GP.A/all?startTime=2015&endTime=2015"
create_query_url(sdmx_data_query = query,
                 data_api_endpoint = "http://stats.oecd.org:80/SDMX-JSON/data")

R4IO/rcw documentation built on Feb. 3, 2020, 11:46 a.m.