3

I am currently working on retrieving mass queries from Google Trends through the package gtrendsr in R. In order to do that, I have first imported a list of words (454 words) as a CSV file in to R and initally declared a vector of these words denoted as "a".

df <- data.frame()

getSeries <- function(a){
out <- NULL
for(i in length(a)){
 trend1 <- gtrends(i, geo = "US", time = "2009-01-01 2009-02-01")
 trend2 <- gtrends(i, geo = "US", time = "2009-03-01 2009-04-01")
 vec <- rbind(as.matrix(trend1),as.matrix(trend2))
 out <- cbind(out,vec)
 }
return(out)
Sys.sleep(10)
}
getSeries(a)

By applying this Code, I receive the following error message:

 Error: widget$status_code == 200 is not TRUE

I am quite a noob in R, but I assume that the error above has something to do with the mass queries I am requesting through this code. Did somebody already have faced this issue and came up with a solution?

I am using the the developer package of gtrendsR:

if (!require("devtools")) install.packages("devtools")
devtools::install_github('PMassicotte/gtrendsR')

I am looking forward to all of your Support. Thanks :)

D S Seon
  • 63
  • 4

0 Answers0