add_control_keyword {globaltrends} | R Documentation |
The function adds one or more batches of keywords with a time period for downloads to the database. The batches serve as input for all download and computation functions.
add_control_keyword(keyword, time = "2010-01-01 2020-12-31")
add_object_keyword(keyword, time = "2010-01-01 2020-12-31")
keyword |
Keywords that should be added as batch. Vector of type
|
time |
Time frame for which the batch data should be downloaded. Object
of type |
Since Google Trends allows a maximum of five keywords for each query, batches
of control keywords can consist of up to five keywords. Since one control
keyword is added to batches of object keywords for mapping, object batch
length is limited to four keywords. When a character
vector contains
more than four (five) keywords, the vector is split into four-keyword
(five-keyword) batches. A list
must contain character
vectors
of length four (five) or less. Each batch of keywords is combined with a time
period for which data will be downloaded. To change the time period for an
existing batch, all downloads and computations must be rerun.
Message that the batch has been created successfully. Batch data is written to tables batch_keywords and batch_time. Numeric vector containing the newly added batch numbers are returned.
If you use search topics for object keywords, make sure to use search topics for control keywords and vice versa. See Google's FAQ for additional information on search topics.
To avoid trailing spaces stringr::str_squish
is automatically
applied to all keywords.
## Not run:
add_control_keyword(
keyword = c("gmail", "maps", "translate", "wikipedia", "youtube"),
time = "2016-01-01 2019-12-31"
)
add_object_keyword(
keyword = c("apple", "facebook", "google", "microsoft"),
time = "2016-01-01 2019-12-31"
)
add_control_keyword(
keyword = c("gmail", "maps", "news", "translate", "weather", "wikipedia", "youtube"),
time = "2016-01-01 2019-12-31"
)
add_control_keyword(
keyword = c("amazon", "apple", "facebook", "google", "microsoft", "netflix", "twitter"),
time = "2016-01-01 2019-12-31"
)
add_control_keyword(
keyword = list(
c("gmail", "maps", "news"),
c("translate", "weather", "wikipedia", "youtube")
),
time = "2016-01-01 2019-12-31"
)
add_control_keyword(
keyword = list(
c("amazon", "apple", "facebook", "google"),
c("microsoft", "netflix", "twitter")
),
time = "2016-01-01 2019-12-31"
)
# search topics
add_control_keyword(
keyword = c("%2Fm%2F02q_bk", "%2Fm%2F055t58", "%2Fm%2F025sndk", "%2Fm%2F0d07ph", "%2Fm%2F09jcvs"),
time = "2016-01-01 2019-12-31"
)
# This adds the following topics: Gmail, Google Maps, Google Translate, Wikipedia, YouTube
## End(Not run)