library(gtrendsR)
user <- "@gmail.com"
psw <- "password"
gconnect(user, psw)
lang_trend <- gtrends(c("Soccer", "Footbal" , "Basketball"), res="7d")
plot(lang_trend)
我想通过列表上的循环生成类似的resalts:
sport<- as.list(c("Soccer", "Footbal" , "Basketball"))
mylist= list() #create a empty list
for (i in sport) {
dat <- gtrends(sport[1], res="7d")
dat$i <- i # Here I would like to add the name of the sports
datalist[[i]] <- gtrends(a[1], res="7d") # add it to your list
}
我想生成一个像这样的表/数据框:
Date Soccer Football Basketball
12.06 100 50 30
13.06 90 30 20
14.06 80 40 20