trendyy
is a package to provide a tidy interface to the gtrendsR
package by Philippe Massicotte.
The idea was to provide an interface to the package that is tibble
friendly. This package provides accessor functions to the various data frames that gtrendsR
provides.
trendy()
enables you to query Google Trends. The only required argument is search_terms
. If you submit 5 or few search terms as a character vector, the terms will be compared to eachother. If more than 5 terms are submitted, each will be qeuried on it's own.
Optionally, you can provide a desired date range in the format of "YYYY-MM-DD"
to the from
and to
arguments. Other arguments that are passed to gtrendsR::gtrends()
are also valid, including the time
argument.
trendy()
returns an object of class trendy
. To access the tables, use any of the accessor functions below:
get_interest()
: trends over timeget_interest_city()
: trends by cityget_interest_country()
: trends by countryget_interest_dma()
: trends for a designated marketing areaget_interest_region()
: trends by regionget_related_queries()
: related search phrasesget_related_topics()
: related topicslibrary(trendyy)
library(dplyr)
ob <- trendy("Obama",
from = Sys.Date() - 365,
to = Sys.Date()) %>%
get_interest()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.