[R tool] Google Trends comparator for 5+ terms

As part of our research on the geography of search engines, we coded a new R tool, including ideas from my colleague Simon Scheider (Universiteit Utrecht). Google Trends is a great source of “big data” about search behaviour at a large scale, but it limits the number of query terms to 5. Because of the way the Google Trends index is scaled between 100 and 0, many terms fall to 0, and are practically unusable.

Google Trends comparator 5 terms
This tool extracts data from the Google Trends API

The Google Trends comparator overcomes this limitation, allowing an arbitrary number of terms as input for the Google Trends API, and producing a new index scaled between 0 and 1000.

[GitHub repository with code and examples]

For example, for 10 terms Austria, Belgium, Cyprus, Denmark, Estonia, Finland, Germany, Greece, Hungary, and Italy, the script produces this table, where scaled_hits is the Google Trends index, and hits1000 is the same value rescaled between 0 and 1000 for readability. Note that hits is the average of the Google Trends index in the selected time_span.

term scaled_hits hits1000 collected_at time_span
Austria 101.9617 324.2405 2018-12-11 11:22 2017-12-17 2018-12-02
Belgium 123.5705 392.957 2018-12-11 11:22 2017-12-17 2018-12-02
Cyprus 74.1176 235.6956 2018-12-11 11:22 2017-12-17 2018-12-02
Denmark 76.9148 244.5908 2018-12-11 11:22 2017-12-17 2018-12-02
Estonia 19.8276 63.0522 2018-12-11 11:22 2017-12-17 2018-12-02
Finland 53.7647 170.9729 2018-12-11 11:22 2017-12-17 2018-12-02
Germany 314.4632 1000 2018-12-11 11:22 2017-12-17 2018-12-02
Greece 151.9191 483.1061 2018-12-11 11:22 2017-12-17 2018-12-02
Hungary 35.1315 111.719 2018-12-11 11:22 2017-12-17 2018-12-02
Italy 299.5809 952.674 2018-12-11 11:22 2017-12-17 2018-12-02

As always, suggestions and feedback are welcome.