0

I'm just new with R-programming and Google Trends, so forgive me for this basic question. I successfully acquired some google trends data from a tutorial like this:

library(gtrendsR)
library(methods)
usr <- "<usr>"
psw <- "<psw>"
gconnect(usr, psw) 
lang_trend <- gtrends(c("pga", "nhl", "nba", "nfl"))
plot(lang_trend)

I get a nice plot for all 4 terms. enter image description here Now I'd like to know how to just plot the data for just nba for example

Thanks in advance!

user3488736
  • 109
  • 1
  • 3
  • 13

1 Answers1

2

This could help get you started. From the documentation of the gtrendsR package: lang_trend is "An object of class ‘gtrends’ which is list with six elements containing the results. "

    library(gtrendsR)
    library(methods)
    usr <- "<usr>"
    psw <- "<pwd>"
    gconnect("<usr>", "<pwd>") 
    lang_trend <- gtrends(c("pga", "nhl", "nba", "nfl"))
    plot(lang_trend$trend[ ,"start"], lang_trend$trend[,"nba."], type = "lines")
Valter Beaković
  • 3,140
  • 2
  • 20
  • 30