PMassicotte / gtrendsR

R functions to perform and display Google Trends queries
352 stars 112 forks source link

How do you turn off comparison? #420

Closed marcyshieh closed 2 years ago

marcyshieh commented 2 years ago

I have the following code:

result <- gtrends(c("apple", "orange"), geo = "US", time = "2004-08-04 2004-11-02", onlyInterest = TRUE)

I don't want to compare apple and orange to each other. I want a hit of "100" for apple and a hit of "100" for orange.

Any guidance is appreciated!

JBleher commented 2 years ago

How about separate queries?

result <- lapply(c("apple", "orange"),function(x) gtrends(x, geo = "US", time = "2004-08-04 2004-11-02", onlyInterest = TRUE))

marcyshieh commented 2 years ago

@JBleher This is great! Thank you!

And in case anyone wants to put their results into a dataframe:

library(plyr)
df <- ldply(result, data.frame)