There you go! This is a much more intuitive result, where you’ll find that the search term for “榮光” reaches its peak in mid-September of 2019, whereas search volume for the English term is relatively lower, but still peaks at the same time. Mutate_at("hits", ~as.numeric(.)) %>% # convert to numeric The onlyInterest argument is set to TRUE, which only returns interest over time and therefore is faster.I’ll try to do this in a single pipe-line. It could also be a quirk of Google Trends that it doesn’t return long Chinese search queries properly. I’ll now re-run this piece of analysis, using the shorter term 榮光, as the hypothesis is that people are more likely to search for that instead of the full song name. This finding above is surprising, because you would expect that Hong Kong people are more likely to search for the Chinese term rather than the English term, as the original piece was written in Cantonese. Geom_line(colour = "darkblue", size = 1.5) + I really like the Economist theme from ggthemes, so I’ll use that: output_results %>% Let us plot this in ggplot2, just to try and replicate what we normally see on the Google Trends site – i.e. visualising the search trends over time. The resulting numbers are then scaled on a range of 0 to 100 based on a topic’s proportion to all searches on all topics. Otherwise, places with the most search volume would always be ranked highest. Search results are normalized to the time and location of a query by the following process:Įach data point is divided by the total searches of the geography and time range it represents to compare relative popularity. Google Trends normalizes search data to make comparisons between terms easier. This is what the hits variable represents, according to Google’s FAQ documentation: # $ keyword "Glory to Hong Kong", "Glory to Hong Kong", "Glory to. You can access the data frame with the $ operator, and check out the data structure: output_results %>% Let’s have a look at interest_over_time, which is primarily what we’re interested in. Output_results is a gtrends/list object, which you can extract all kinds of data from: output_results %>% summary() We’ll assign the output to a variable – and let’s call it output_results. Let’s set the geo argument to Hong Kong only, and limit the search period to 12 months prior to today. The next step then is to assign our search terms to a character variable called search_terms, and then use the package’s main function gtrends(). Let’s load tidyverse as well, which we’ll need for the basic data cleaning and plotting: library(gtrendsR) GtrendsR is available on CRAN, so just make sure it’s installed ( install.packages("gtrendsR")) and load it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |