plot_bar {globaltrends}R Documentation

Create barplot for cross-sectional globaltrends data

Description

The function creates barplots for cross-sectional search score data. It uses the output of export_score to prepare a bar plot of search scores for the top 10 countries. For output from get_abnorm_hist the plot shows five locations with the highest and lowest abnormal changes each. When the output includes more than one keyword, only the first keyword is used.

Usage

plot_bar(data, ...)

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

## S3 method for class 'abnorm_score'
plot_bar(data, ...)

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".

Value

Barplot of cross-sectional data as ggplot2 object.

Examples

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

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

## End(Not run)


[Package globaltrends version 0.0.14 Index]