# NOT RUN {
session <- gconnect("usr@gmail.com", "psw")
gtrends(c("NHL", "NBA", "MLB", "MLS"))
gtrends("NHL", geo = c("CA", "US"))
# Search only for the sport category.
gtrends("NHL", geo = c("CA", "US"), cat = "0-20")
# Trends between 2015-01-01 and 2015-03-01 in Sweeden. Will be daily data.
gtrends("NHL", geo = c("SE"), start_date = "2015-01-01", end_date = "2015-03-01")
# Trends between 2015-01-01 and 2015-04-01 in Sweeden. Will be weekly data.
gtrends("NHL", geo = c("SE"), start_date = "2015-01-01", end_date = "2015-04-01")
# Last 4 hours trends
gtrends("NHL", geo = c("CA"), res = "4h")
# Last 7 days trends
gtrends("NHL", geo = c("CA"), res = "7d")
# Using categories
data("categories")
categories[grepl("music", categories$name, ignore.case = TRUE), ]
gtrends(cat = "1087")
# }
# NOT RUN {
data("sport_trend")
plot(sport_trend)
# }
Run the code above in your browser using DataLab