The function downloads search volumes from Google Trends for an object batch
(batch_o) and one keyword from a control batch (batch_c) in a
set of locations. Data is automatically written to table
data_object. For download_object_global
the input
location is automatically set to world.
download_object(object, control = 1, locations = gt.env$countries, ...)# S3 method for numeric
download_object(object, control = 1, locations = gt.env$countries, ...)
# S3 method for list
download_object(object, control = 1, locations = gt.env$countries, ...)
download_object_global(object, control = 1, ...)
Message that data was downloaded successfully. Data is written to table data_object.
Object batch for which the data is downloaded. Object
of type numeric
or object of type list
containing single
object of type numeric
.
Control batch that is used for mapping. Object of type
numeric
. Defaults to 1
.
List of countries or regions for which the data is
downloaded. Refers to lists generated in start_db
. Defaults to
countries
.
Arguments that are passed on to the gtrendsR::gtrends
function.
We advise against the usage of category codes in downloads. If you use categories to narrow the context of keyword usage, these categories are applied to ALL keywords in the batch. This applies to control keywords as well as object keywords and can result in unintended behavior.
Downloads through the Google Trends API are made through
gtrendsR::gtrends
. Each object batch can consist of up to four
keywords and is predefined in tables batch_keywords and
batch_time through add_keywords
. In addition, one control
keyword is added to each object batch. The control keyword then allows a
mapping between search volumes for control keywords stored in
data_control and search volumes for object keywords. The download for
a single keyword batch for a single location takes about 30 seconds. This
includes a randomized waiting period of 5-10 seconds between downloads.
Depending on the frequency of downloads, Google Trends might block users
for some time. In this case, download_object
waits 60 minutes
before it retries the download.
example_object()
gtrendsR::gtrends()
if (FALSE) {
download_object(
object = 1,
locations = countries
)
download_object(
object = as.list(1:5),
locations = countries
)
}
Run the code above in your browser using DataLab