plot_box {globaltrends}R Documentation

Create boxplot for time series of globaltrends data

Description

The function creates boxplots for time series globaltrends data. It uses the output of export_... or get_abnorm_hist to prepare boxplots for up to nine keywords.

Usage

plot_box(data, ...)

## S3 method for class 'exp_score'
plot_box(data, type = c("obs", "sad", "trd"), ...)

## S3 method for class 'abnorm_score'
plot_box(data, ci = 0.95, ...)

## S3 method for class 'exp_voi'
plot_box(data, type = c("obs", "sad", "trd"), ...)

## S3 method for class 'abnorm_voi'
plot_box(data, ci = 0.95, ...)

## S3 method for class 'exp_doi'
plot_box(
  data,
  type = c("obs", "sad", "trd"),
  measure = c("gini", "hhi", "entropy"),
  locations = "countries",
  ...
)

## S3 method for class 'abnorm_doi'
plot_box(
  data,
  type = c("obs", "sad", "trd"),
  locations = "countries",
  ci = 0.95,
  ...
)

Arguments

data

Data exported from export_... or compute_abnorm functions.

...

Further arguments passed to or from other methods.

type

Object of type character indicating the type of time series-column from data_score, takes either obs, sad, or trd. Defaults to "obs".

ci

Confidence interval within which changes are assumed to be normal. Object of type ⁠double, 0 < ci < 1⁠. Defaults to 0.95.

measure

Object of type character indicating the DOI measure, takes either gini, hhi, or entropy. Defaults to "gini".

locations

Object of type character indicating for which set of locations should be filtered. Defaults to "countries".

Details

For output of export_score, only data for a single location is shown. When date for more than one location is provided, the function selects only the first location. For output of get_abnorm_hist, users can specify confidence intervals to highlight abnormal changes in the data.

Value

Boxplot of time series as ggplot2 object. For plots for output from get_abnorm_hist the provided confidence interval is indicated by red dots.

Examples

## Not run: 
data <- export_score(keyword = "amazon")
plot_box(data, type = "obs")

data <- export_voi(keyword = "amazon")
data <- get_abnorm_hist(data, train_win = 12, train_break = 0, type = "obs")
plot_box(data)

data <- export_doi(keyword = "amazon")
data <- get_abnorm_hist(data, train_win = 12, train_break = 0, measure = "gini")
plot_box(data, ci = 0.9)

## End(Not run)


[Package globaltrends version 0.0.14 Index]