# load the necessary packages
library(wbstats)
library(tidyverse)
library(ggplot2)
library(ggthemes)
theme_set(theme_few())
# Next, I will retrieve the necessary data from the World Bank using the wbstats package.
# I will be using two indicators: life expectancy at birth (SP.DYN.LE00.IN) and health expenditure
# per capita (SH.XPD.CHEX.PC.CD).
life_expectancy <- wb_data(indicator = "SP.DYN.LE00.IN", start_date = 1990, end_date = 2019)
health_expenditure <- wb_data(indicator = "SH.XPD.CHEX.PC.CD", start_date = 1990, end_date = 2019)
# To merge the data into one dataframe, I will use the merge_wb function from the wbstats package.
health_life <- merge(health_expenditure, life_expectancy, by = c("iso3c", "date"))
# Now that we have the necessary data, we can explore the relationship between health expenditures
# and life expectancy over time using a scatter plot.
# Plot life expectancy against health expenditure
ggplot(health_life, aes(x = SH.XPD.CHEX.PC.CD, y = SP.DYN.LE00.IN)) +
geom_point(alpha = 0.5) +
scale_x_log10(labels = scales::dollar_format(scale = 1e-9, suffix = "B")) +
labs(title = "Life Expectancy vs Health Expenditure per capita",
x = "Health Expenditure per capita (USD)",
y = "Life Expectancy (years)") +
theme(plot.title = element_text(hjust = 0.5),
panel.grid.minor = element_blank(),
panel.grid.major = element_line(colour = "grey", size = 0.2),
axis.text = element_text(size = 8))
This graph demonstrates the favorable relationship between health spending per person and life expectancy. The data points are grouped in the plot’s upper left corner, showing that the majority of nations spend less than $10,000 USD per person on health care and have life expectancies under 80 years. However, there are a few anomalies that have a life expectancy of more than 80 years and spend more than 10,000 USD per individual on healthcare.
Conclusion: Although this study demonstrates a correlation between health spending and life expectancy, some nations still have low life expectancies despite high health spending. This emphasizes the requirement for additional study and focused interventions to enhance health results in these nations.
# load necessary packages
library(gtrendsR)
library(ggplot2)
library(dplyr)
# Retrieve data from Google Trends
veganism_trends <- gtrends(keyword =c("veganism") , gprop="web", time = "all", geo = c("US"))
plant_based_trends <- gtrends(keyword = ("plant based diet"), gprop="web", time = "all", geo = c("US"))
# Combine data into one data frame
trends_df <- data.frame(date = as.Date(veganism_trends$interest_over_time$date),
veganism = veganism_trends$interest_over_time$hits,
plant_based_diet = plant_based_trends$interest_over_time$hits)
# Convert plant_based_diet variable to integer
trends_df$plant_based_diet <- as.integer(trends_df$plant_based_diet)
# Plot trends on the same plot
ggplot(data = trends_df, aes(x = date)) +
geom_line(aes(y = veganism, color = "veganism")) +
geom_line(aes(y = plant_based_diet, color = "plant-based diet")) +
scale_color_manual(name = "Search Term", values = c("veganism" = "blue", "plant-based diet" = "red")) +
labs(title = "Google Trends: Veganism vs Plant-Based Diet",
x = "Date",
y = "Search Interest",
color = "Search Term") +
theme_minimal()
The United States’ interest in plant-based diets has significantly
changed over the last twenty years, according to a trend analysis of
Google search data for the words “veganism” and “plant-based diet.” The
data reveals that the volume of searches for “plant-based diet” has
steadily increased since 2016, while the volume of searches for
“veganism” has stayed largely stable.
The data’s first obvious pattern is that both words exhibit seasonal patterns, with peaks in January and troughs in July. Given that many people may begin the year with health and fitness resolutions, which frequently include dietary changes, this tendency is consistent with holiday customs and New Year’s resolutions.
The volume of searches for “plant-based diet” has increased consistently despite the seasonal trend, with a noticeable increase in early 2018 that corresponds with the launch of the Netflix documentary “The Game Changers.” This documentary appears to have significantly increased popular interest in plant-based diets by examining the performance and health advantages of such a diet.
However, “veganism” seems to have hit its peak search volume in 2017, after reaching its all time high early 2004. Interestingly, “veganism” has had a marginal decline in interest in the years that followed. The perceived strictness of the vegan diet, which may not be appropriate for everyone, or the unfavorable connotations attached to the word “veganism,” which some people may find too extreme, could be the cause of this trend.
Overall, the trend analysis suggests a growing interest in plant-based diets as an alternative to traditional diets. This shift in interest may be driven by health, environmental, or ethical concerns, or a combination of all three. With the increased availability of plant-based food options and the growing body of research on the benefits of plant-based diets, it is likely that this trend will continue in the future.