library(tidyverse)
library(dplyr)
datainput <- read_csv("DP_LIVE_29112020020227678.csv", )
datainput1 <- select(datainput, 'LOCATION', 'TIME', 'Value')
datainput3 <- datainput1[datainput1$'LOCATION' == "BEL"|datainput1$'LOCATION' == "ITA"|datainput1$'LOCATION' == "GRC",]
datainput2 <- datainput3 %>% rename(Percent = Value, Year = TIME, Country = LOCATION)
datainput2$Country <- ifelse(datainput2$Country %in% ("BEL"), "Belgium", datainput2$Country)
datainput2$Country <- ifelse(datainput2$Country %in% ("ITA"), "Italy", datainput2$Country)
datainput2$Country <- ifelse(datainput2$Country %in% ("GRC"), "Greece", datainput2$Country)
datainput6 <- datainput2 %>%
mutate(Year = as.integer(Year))
ggplot(data = datainput6, aes(x = Year, y = Percent, color = Country)) +
geom_line()+ geom_point()+
ggtitle("% of Medical Expenses Going Towards Pharmaceuticals")
greece <- datainput2[datainput2$'Country' == "Greece",]
ggplot(data = greece, aes(x = Year, y = Percent)) +
geom_line()+ geom_point()+
scale_y_continuous(expand = c(0, 0), limits = c(0, NA))+
ggtitle("% of Medical Expenses Going Towards Pharmaceuticals in Greece")
ggplot(data = greece, aes(x = Year, y = Percent)) +
geom_line()+ geom_point()+
ggtitle("Potentially Misleading % of Medical Expenses Going Towards Pharmaceuticals in Greece")
datatable1 <- datainput2 %>% rename("Pharm %" = Percent)
datatable <- datatable1 %>%
filter(Year == 2016| Year == 2017|Year ==2018)
library(knitr)
kable(datatable, align = "lcc", caption = '__Pharmaceutical spend as a percentage of total healthcare costs for 2016-2018__')
| Country | Year | Pharm % |
|---|---|---|
| Belgium | 2016 | 14.329 |
| Belgium | 2017 | 14.155 |
| Belgium | 2018 | 14.584 |
| Greece | 2016 | 26.700 |
| Greece | 2017 | 27.597 |
| Greece | 2018 | 26.238 |
| Italy | 2016 | 17.647 |
| Italy | 2017 | 17.609 |
| Italy | 2018 | 17.904 |
What I found most interesting is that the countries in Europe that I selected do not have any major correlation to each other’s spending behaviors. I had a lot of issues with this project. I initially had another data set on education levels in Europe, but could not figure out how to properly graph the data. My assumption was that the percentage column was a chr factor, and I could not figure out how to convert that column into a number or integer. I attempted various renditions of as.integer to no aval. Additionally, on this data, I had a similar problem with the year data being in number form and while I was successful in converting year to an integer the graph still added a decimal place.