Get Google trends data - problem with output

Fun question,
With these kinds of coding questions, it's usually polite to provide a fully reproducible to save responders' time. (If you're not familiar with what that is; FAQ: What's a reproducible example (`reprex`) and how do I do one?)


Having said that, I couldn't help but notice that you are saving this data to a text file, and calling head.

  • head's default is to return the top 6 results in a situation like this.
  • why are you saving your data this way? when you could just save it as a csv, rdata, or feather or whathaveyou?

For example

library(gtrendsR)
library(readr)
temp = gtrends(c("VCB"), geo = "VN", time = "now 7-d", gprop = c("web"), category = 7, hl = "en-US", low_search_volume = TRUE)
temp = temp$interest_over_time

write_csv(
  temp,
  "output1.csv",
  
)

Created on 2018-05-09 by the reprex package (v0.2.0).

1 Like