download_control {globaltrends}R Documentation

Download data for control keywords

Description

The function downloads search volumes from Google Trends for a control batch in a set of locations. Data is automatically written to table data_control. For download_control_global the input location is automatically set to world.

Usage

download_control(control, locations = gt.env$countries, ...)

## S3 method for class 'numeric'
download_control(control, locations = gt.env$countries, ...)

## S3 method for class 'list'
download_control(control, locations = gt.env$countries, ...)

download_control_global(control, ...)

Arguments

control

Control batch for which the data is downloaded. Object of type numeric or object of type list containing single objects of type numeric.

locations

List of countries or regions for which the data is downloaded. Refers to lists generated in start_db. Defaults to gt.env$countries.

...

Arguments that are passed on to the gtrendsR::gtrends function.

Details

Downloads through the Google Trends API are made through gtrendsR::gtrends. Each control batch can consist of up to five keywords and is predefined in tables batch_keywords and batch_time through add_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_control waits 60 minutes before it retries the download.

Value

Message that data has been downloaded successfully. Data is written to table data_control.

Warning

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.

See Also

Examples

## Not run: 
download_control(
  control = 1,
  locations = countries
)
download_control(
  control = as.list(1:5),
  locations = countries
)

## End(Not run)


[Package globaltrends version 0.0.14 Index]