Quantcast
Channel: r software hub
Viewing all articles
Browse latest Browse all 1015

gtrendsR 1.3.3

$
0
0

By Thinking inside the box

Donald Drump query

A very nice new update to the gtrendsR package by Philippe and myself is now avilable via CRAN. I had only blogged about the initial 1.3.0 release, and we have added a whole slew of new features and fixes. Philippe rewrote a lot of the parsing to make it more robust to different encodings, and add other features. So in no particular order, we can now sub-group by regions more finely, withstand various misfeatures in returned data sets, generally do better on connections, and more — and also allow for intra-day, daily and weekly queries!

That last part is pretty fun. Here is the code I ran last Saturday to look at the query for Donald Drumpf, a name brought to us via a beautiful John Oliver episode worth watching which ran about nine days ago. So last Saturday, when we were still within the seven day window, I ran

library(gtrendsR)
dp  gtrends("Donald Drumpf", res="7d")
p + ggplot2::ggtitle("The Drumpf") + ggplot2::theme(legend.position="none")

which resulted in the following chart

which highlights another nice feature: the ggplot2 object created by the plotting function is returned, so we can locally modify and tune it. Here is set a title and suppress the default legend.

As I had not blogged about the interim bug-fix releases 1.3.1 and 1.3.2, here is the set of NEWS entries for the last three releases:

gtrendsR 1.3.3

  • A ggplot2 object can now be returned for further customization. plot(gtrends("NHL")) + ggtitle("NHL trend") + theme(legend.position="none")

  • Support for hourly and daily data (#67). For example, it is now possible to have hourly data for the last seven days with gtrends("nhl", geo = "CA", res = "7d"). Use ?gtrends for more information about the time resolution supported by the package.

  • Support for categorties (#46). Ex.: gtrends("NHL", geo = "US", cat = "0-20") will search only in the sport category.

  • <li …read more

    Source:: r-bloggers.com


Viewing all articles
Browse latest Browse all 1015

Trending Articles