Downloads approximate daily series over a sequence of time-windows by first constructing the appropriate time windows and then downloading daily data for each time-window using ts_gtrends().

ts_gtrends_windows(
  keyword = NA,
  category = "0",
  geo = "CH",
  from = "2019-01-01",
  prevent_window_shrinkage = FALSE,
  stepsize = 7,
  windowsize = 80,
  n_windows = 12,
  quiet = FALSE,
  wait = 60,
  retry = 5
)

Arguments

keyword

A character vector with the actual Google Trends query keywords. Defaults to NA which searches for the whole category. Contrary to gtrendsR::gtrends(), if different keywords are used, mulitple queries are sent to Google, and each series is individually normalized.

category

A character vector, listing the categories, defaults to "0". Passed to gtrendsR::gtrends()

geo

A character vector denoting geographic regions for the query, default is "CH". Passed to gtrendsR::gtrends()

from

Start of timeframe in YYYY-mm-dd form.

prevent_window_shrinkage

If TRUE, ensures that the last time-window is large enough to yield the desired frequency. Default is FALSE.

stepsize

Number of days (integer) between the start days of the respective time-windows.

windowsize

Number of days (integer) from start date to end date of each window.

n_windows

Number (integer) of time-windows.

quiet

If TRUE won't display messages related to server interactions. Default is FALSE.

wait

Seconds to wait between attempts, where waiting time is attempt * wait.

retry

Number of attempts, in case the query request does not succeed.

Value

A tibble of time series with columns window, time, value, where window is the time window indicated by start and end date of the window.

Notes

Time-windows may overlap - and will do so if stepsize < windowsize.

See also