plot_ts {globaltrends} | R Documentation |
Plot time series of globaltrends data
Description
The function creates line plots for time series globaltrends data. It uses
the output of export_...
or get_abnorm_hist
to prepare line plots for up
to nine keywords.
Usage
plot_ts(data, ...)
## S3 method for class 'exp_score'
plot_ts(data, type = c("obs", "sad", "trd"), smooth = TRUE, ...)
## S3 method for class 'abnorm_score'
plot_ts(data, ci = 0.95, ...)
## S3 method for class 'exp_voi'
plot_ts(data, type = c("obs", "sad", "trd"), smooth = TRUE, ...)
## S3 method for class 'abnorm_voi'
plot_ts(data, ci = 0.95, ...)
## S3 method for class 'exp_doi'
plot_ts(
data,
type = c("obs", "sad", "trd"),
measure = c("gini", "hhi", "entropy"),
locations = "countries",
smooth = TRUE,
...
)
## S3 method for class 'abnorm_doi'
plot_ts(
data,
type = c("obs", "sad", "trd"),
locations = "countries",
ci = 0.95,
...
)
Arguments
data |
Data exported from |
... |
Further arguments passed to or from other methods. |
type |
Object of type |
smooth |
Object of type |
ci |
Confidence interval within which changes are assumed to be normal.
Object of type |
measure |
Object of type |
locations |
Object of type |
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
Line plot 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_ts(data, type = "obs")
data <- export_voi(keyword = "amazon")
data <- get_abnorm_hist(data, train_win = 12, train_break = 0, type = "obs")
plot_ts(data)
data <- export_doi(keyword = "amazon")
data <- get_abnorm_hist(data, train_win = 12, train_break = 0, measure = "gini")
plot_ts(data, ci = 0.9)
## End(Not run)