ts_gtrends | R Documentation |
Wrapper around gtrendsR::gtrends()
that modifies the original function by
a) vectorizing it, b) converting the result to tsboxable tibble and c)
retries if no result is returned.
ts_gtrends(
keyword = NA,
category = "0",
geo = "CH",
time = "today+5-y",
retry = 5,
wait = 5,
quiet = FALSE
)
keyword |
A character vector with the actual Google Trends query
keywords. Defaults to NA which searches for the whole category. Contrary
to |
category |
A character vector, listing the categories, defaults to
|
geo |
A character vector denoting geographic regions for the query,
default is |
time |
A string specifying the time span of the query. Possible values are:
|
retry |
Number of attempts, in case the query request does not succeed. |
wait |
Seconds to wait between attempts, where waiting time is |
quiet |
If TRUE won't display messages related to server interactions. Default is FALSE. |
A tibble of time series for the different keywords or categories. If only a single keyword and a single category are specified, the tibble has columns time and value. If either more than one keyword, or more than one category are given, an additional column id indicates either the keyword, or the category.
The function takes the id's as strings, not the names. For example, "Arts & Entertainment" has to be specified as "2".
Multiple keywords or multiple categories can be specified, but not both.
gtrendsR::gtrends()
, browseVignettes("intro")
Online tutorial for analyzing google trends in R
x <- ts_gtrends("Rezession")
x
tsbox::ts_plot(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.