Code
library(tidyverse)
library(packrat)
library(tidytext)
library(tidyselect)
library(tidymodels)
library(httr)
library(jsonlite)
library(gtrendsR)
library(ggplot2)
library(googleVis)Part 1 of a Google Trends Analysis of Trends from January 1, 2015 through May 1, 2023
This analysis is a response to an increase in Google searches for “microclots” between April 25, 2023 to May 1, 2023.
Google trends reported that searches for “microclots” were up 23% for the period between April 25, 2023-May 1, 2023. The increase follows the release of mainstream media news reports on the long-term risks of COVID-19 infection, including that these risks increase exponentially with the third infection. To understand why the interest in “microclots” increased, it is important to understand what interest in “microclots” looked like prior to the COVID-19 pandemic, too.
This analysis explores Google search trends for “microclots” and related queries from January 1, 2015-May 1, 2023 using tidy methods (tidyverse) and the “gtrendsR” “googleVis” and “ggplot2” packages in R.
All analyses were executed in RStudio IDE for Mac (Intel, MacbookPro 2020, OS Ventura).
The code and annotations in this document are part of my ongoing research programme focused on the social facts of COVID-19 risk and mitigation. Annotations are focused on interpreting the results of the analysis, and figures/visualizations are provided as a means of presenting important information about a trending interest related to COVID-19 infection. This document is not a tutorial on how to use gtrendsR, googleVis, ggplot2, and the tidyverse set of packages in R. The code included in this document may serve as a useful example if you have background knowledge of the packages used for the analysis. You can find tutorials with information about how to use gtrendsR and covering data visualization in R HERE.
--------------------------------------------------------------
library(tidyverse)
library(packrat)
library(tidytext)
library(tidyselect)
library(tidymodels)
library(httr)
library(jsonlite)
library(gtrendsR)
library(ggplot2)
library(googleVis)clots1 <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01")clots1_iot <- clots1$interest_over_timeclots1_iot <- clots1_iot %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))clots1_iot %>%
ggplot(aes(x = d_date,
y = n_hits,
color = keyword)) +
geom_point() +
geom_line() +
labs(title = "Google Search Trends for 'microclots' from Jan 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Global Search Hits",
alt = paste("A line plot showing the proportion of Google search hits between January 1, 2017 and December 31, 2022, globally, for disability keywords: disability, chronic, illness, spoonie, and zebra. The proportion compares hits of each keyword versus the other four."))clots1_iot_gv <- gvisAnnotationChart(clots1_iot,
datevar="d_date",
numvar="hits",
options=list(width=800, height=500, fill=10, displayExactValues=TRUE, colors="['#ff0000']"))plot(clots1_iot_gv)clots1_ibc <- clots1$interest_by_countryclots1_ibc <- clots1_ibc %>%
mutate(hits2 = replace(hits, hits==c(""), 0)) %>%
filter(hits2 > 0) %>%
mutate(hits3 = factor(hits2))levels(clots1_ibc$hits3)[1] "12" "17" "33" "65" "70" "83" "93" "100"
clots1_ibc %>%
ggplot(aes(x = location,
y = hits3,
fill = location)) +
theme(axis.text.x=element_blank(),
axis.ticks.x=element_blank()) +
geom_col() +
labs(title = "Google Search Trends for 'microclots', January 1, 2015 - May 1, 2023",
x = "Country",
y = "Proportion of Google Search Hits",
alt = paste("A barchart showing proportion of Google search hits for the keyword 'microclots', by country, for the entire period between January 1, 2015 and May 1, 2023")) clots1_ibc_baby <- clots1_ibc %>%
select(location, hits)clots1_ibc_gv <- gvisColumnChart(clots1_ibc_baby,
options = list(width=900, height=700, colors = "['#3cb371']"))plot(clots1_ibc_gv)I can use topic modeling to analyze the related topics and related queries information. Storing information for later use in text analyses.
Examine interest over time by country. Need to pull iot by country to do this, not included with basic query.
clots_Canada <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("CA"),
onlyInterest = T)
clots_UK <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("GB"),
onlyInterest = T)
clots_Philippines <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("PH"),
onlyInterest = T)
clots_US <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("US"),
onlyInterest = T)
clots_Australia <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("AU"),
onlyInterest = T)
clots_Germany <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("DE"),
onlyInterest = T)
clots_Netherlands <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("NL"),
onlyInterest = T)
clots_Italy <- gtrends(keyword = c("microclots"),
time = "2015-01-01 2023-05-01",
geo = c("IT"),
onlyInterest = T)clots_Canada <- clots_Canada$interest_over_time
clots_UK <- clots_UK$interest_over_time
clots_Philippines <- clots_Philippines$interest_over_time
clots_US <- clots_US$interest_over_time
clots_Australia <- clots_Australia$interest_over_time
clots_Germany <- clots_Germany$interest_over_time
clots_Netherlands <- clots_Netherlands$interest_over_time
clots_Italy <- clots_Italy$interest_over_timeclots_Canada <- clots_Canada %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))
clots_UK <- clots_UK %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))
clots_Philippines <- clots_Philippines %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))
clots_US <- clots_US %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))
clots_Australia <- clots_Australia %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))
clots_Germany <- clots_Germany %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))
clots_Netherlands <- clots_Netherlands %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))
clots_Italy <- clots_Italy %>%
mutate_at("hits", ~ifelse(. == "<1", 0.5, .)) %>%
mutate(n_hits = as.numeric(hits)) %>%
mutate(d_date = lubridate::as_date(date))clots_CAN_baby <- clots_Canada %>%
select(date = d_date, hits = n_hits, country = geo)
clots_UK_baby <- clots_UK %>%
select(date = d_date, hits = n_hits, country = geo)
clots_PH_baby <- clots_Philippines %>%
select(date = d_date, hits = n_hits, country = geo)
clots_US_baby <- clots_US %>%
select(date = d_date, hits = n_hits, country = geo)
clots_AU_baby <- clots_Australia %>%
select(date = d_date, hits = n_hits, country = geo)
clots_DE_baby <- clots_Germany %>%
select(date = d_date, hits = n_hits, country = geo)
clots_NL_baby <- clots_Netherlands %>%
select(date = d_date, hits = n_hits, country = geo)
clots_IT_baby <- clots_Italy %>%
select(date = d_date, hits = n_hits, country = geo)clots2_iot <- rbind(clots_CAN_baby, clots_UK_baby)
clots2_iot <- rbind(clots2_iot, clots_PH_baby)
clots2_iot <- rbind(clots2_iot, clots_US_baby)
clots2_iot <- rbind(clots2_iot, clots_AU_baby)
clots2_iot <- rbind(clots2_iot, clots_DE_baby)
clots2_iot <- rbind(clots2_iot, clots_NL_baby)
clots2_iot <- rbind(clots2_iot, clots_IT_baby)par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots2_iot %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("skyblue1",
"lightgoldenrod1",
"chartreuse2",
"turquoise1",
"firebrick1",
"orchid2",
"pink1",
"chocolate1"),
breaks = c("CA",
"GB",
"PH",
"US",
"AU",
"DE",
"NL",
"IT")) +
labs(title = "Google Search Trends for 'microclots', by Country, from January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits (within Country)") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)Canada Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_CAN_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("skyblue1"),
breaks = c("CA")) +
labs(title = "Google Search Trends for 'microclots', Canada, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)UK Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_UK_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("lightgoldenrod1"),
breaks = c("GB")) +
labs(title = "Google Search Trends for 'microclots', United Kingdom, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)Philippines Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_PH_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("chartreuse2"),
breaks = c("PH")) +
labs(title = "Google Search Trends for 'microclots', Philippines, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)US Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_US_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("turquoise1"),
breaks = c("US")) +
labs(title = "Google Search Trends for 'microclots', Philippines, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)Australia Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_AU_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("firebrick1"),
breaks = c("AU")) +
labs(title = "Google Search Trends for 'microclots', Australia, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)Germany Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_DE_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("orchid2"),
breaks = c("DE")) +
labs(title = "Google Search Trends for 'microclots', Germany, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)Netherlands Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_NL_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("pink1"),
breaks = c("NL")) +
labs(title = "Google Search Trends for 'microclots', Netherlands, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)Italy Only Plot
par(mar = c(4, 4, 5, 8),
oma = c(0.2, 0.2, 0.2, 0.2),
cex = 0.5,
cex.lab = 0.4)
clots_IT_baby %>%
ggplot(aes(x = date,
y = hits,
color = country)) +
geom_point() +
geom_line() +
scale_color_manual(values = c("chocolate1"),
breaks = c("IT")) +
labs(title = "Google Search Trends for 'microclots', Italy, January 1, 2015 - May 1, 2023",
x = "Date",
y = "Proportion of Hits") +
theme_dark(
base_size = 10,
base_family = "serif",
base_line_size = 14/20,
base_rect_size = 14/20
)Searches for “micoclots” from the United Kingdom, Germany, and the United States had clear positive trends, with later time points accounting for the majority of hits for all three countries. However, in 2016 when the increases begin to show, the hits accounted for a much higher proportion of German and UK searches than US searches for “microclots.” German search hits for “microclots” also reach their peak much earlier in 2021 than US search hits, which peak just prior to the start of 2022, drop drastically, then increase sharply for 2022 into May 2023. The peak interest for “microclots” in the United Kingdom occurred slightly later, well into 2022. Considering the large proportion of Uk, German, and US, search hits for “microclots” occurring between 2020-2023, and given the increase becomes more noticeable in 2021 when the science of COVID-19 risk became clearer and the understanding that COVID-19 infections are associated with long term issues with microclotting even/especially for those with “mild” acute SARS-CoV-2 infection became more widespread among scientists, the connection between COVID-19 and microclots was possibly important to the heightened search traffic for “microclots” from Germany, the United Kingdom, and the United States, during the pandemic (est. 2020).
Trends for the other countries (Canada, Philippines, Australia, Netherlands, and Italy) experienced higher peaks and lower troughs than UK, German, and US, search trends for “microclots.” Importantly, the remaining countries seemed to experience “all-or-nothing” patterns to their search hits for “microclots” where searches were either at their peak or virtually non-existent. The peaks seem to occur more frequently for some countries, like Italy, towards the end of the time period, during the COVID-19 pandemic. Most saw high search traffic for microclots as early as 2016, though. This is an important indication that information about microclots may have been more readily available to the public in Canada, the Philippines, Australia, and the Netherlands, than for people in the UK, US, Germany, or Italy, beginning at least several years prior to the COVID-19 pandemic. If this is the case, Canada, the Philippines, Australia, and the Netherlands, may be better poised to manage the long-term complications of COVID-19, particularly those related to microclotting and thrombolytic events, than the United States, United Kingdom, Germany, and Italy. Additional research into the handling of post-acute Covid sequalae should consider these pre-pandemic differences in search traffic for “microclots” when interpreting differences in pandemic-era responses to microclotting.