user18443305
user18443305

Reputation:

Collecting data with 'gtrendsR' for more than 5 keywords

I my research, I intend to investigate on Google Trends the search visibility of some animal groups. For this, I am using the gtrendsR package, with the following commands:

> library(gtrendsR)

> keywords = c("Butterfly", "Cockroach", "Parrot", "Ostrich", "Lion", "Platypus", "Alligator") #setting the search terms.

> country = c('BR') #setting the geographic area (Brazil).

> time <- ("2011-01-01 2021-12-31") #setting the period.

> channel <- 'web' #setting the channels.

However, when I try to run the query, an error message appears:

> trends <- gtrends(keywords, gprop = channel, geo = country, time = time)
Error in gtrends(keywords, gprop = channel, geo = country, time = time): length(keyword) <= 5 is not TRUE

Apparently, this way it's not possible to retrieve results for more than 5 keywords (both on the Google Trends site and with gtrendsR package). How could I do this, with this or another R package?

Upvotes: 1

Views: 657

Answers (1)

Mikes
Mikes

Reputation: 1

Google Trends always indexes all queries on that with the highest relative value in a given timeslot.

If you like to see more than 5 terms in the same comparison like google shows 5 terms you can use the following trick:
build every possible couple of your search terms (for example with combinations(length(searchterms), 2)) from gtools)
draw all searches and look up, which term gathers the most "100" peaks over all couple-comparisons.

This term is therefore the one you can use to paste all other your data together that was drawn with this term as a couple.
I won't paste the ugly code here I used to handle this for me.

Upvotes: 0

Related Questions