gtpreparation: Preparation of Google Trends data

View source: R/gtpreparation.R

gtpreparationR Documentation

Preparation of Google Trends data

Description

gtpreparation downloads for various search requests respective categories data and applies a logarithmic transformation aswell as a seasonal adjustment on downloaded data. The function returns seasonal adjusted first derivatives (lagged if desired).

Usage

gtpreparation(
  keyword = NA,
  category = 0,
  geo = "DE",
  time = str_c("2006-01-01 ", Sys.Date()),
  lags = 0
)

Arguments

keyword

A character vector with search requests.

category

A numerical category ID from Google Trends. As of now, only one category can be given. If you need to use more categories, the use of a for-loop is recommended.

geo

A geographical region to restrict the search queries to.

time

Time period from where the relative values should be taken (for more information, visit the documentation of ts_gtrends). Attention: As this function will only work on monthly data, you need to enter for time a time frame that is longer than 5 years. Otherwise, the time series from Google Trends will be based on weekly or daily data and cannot be evaluated.

lags

Number of delays in additional columns (max. value: 4). Be careful, the first i months will not be returned with i being the number of lags.

Value

Firstly, each row will be log transformed and seasonal adjusted (via seasonal::seas()'s X-13 ARIMA methods). Furthermore, the first derivatives of these adjusted time series will be returned (optionally with additional columns containing lags).

Examples

gtpreparation(keyword = "ikea", time = "2015-01-01 2021-01-01")

johannes97s/ifwtrends documentation built on Oct. 9, 2022, 7:01 p.m.