library(ggplot2)
library(scales)
library(googleVis)
data_path <- 'data/'
df <- read.csv(paste0(data_path,'clean.csv'), header = T)
ggplot(df, aes(x = year, colour = country)) + geom_line(aes(y = df$population)) + theme_bw() + guides(colour = guide_legend(title = NULL)) + labs(y = 'Population in millions') + scale_colour_manual(values = c('#FF3333','#3399FF')) + scale_y_continuous(labels = comma)
Population
ggplot(df, aes(x = year, colour = country)) + geom_line(aes(y = df$natIncome2010bill)) + theme_bw() + guides(colour = guide_legend(title = NULL)) + labs(y = 'Income in billions USD') + scale_colour_manual(values = c('#FF3333','#3399FF'))
National income over time
ggplot(df, aes(x = year, colour = country)) + geom_line(aes(y = df$privWealth2010bill)) + theme_bw() + guides(colour = guide_legend(title = NULL)) + labs(y = 'Wealth in billions USD') + scale_colour_manual(values = c('#FF3333','#3399FF'))
## Warning: Removed 3 rows containing missing values (geom_path).
Private Wealth
ggplot(df, aes(x = year, colour = country)) + geom_line(aes(y = df$perCapitaNatIncome2010)) + theme_bw() + guides(colour = guide_legend(title = NULL)) + labs(y = 'Income in USD') + scale_colour_manual(values = c('#FF3333','#3399FF'))
Income per capita
ggplot(df, aes(x = year, colour = country)) + geom_line(aes(y = df$perCapitaPrivWealth2010)) + theme_bw() + guides(colour = guide_legend(title = NULL)) + labs(y = 'Private Wealth in USD') + scale_colour_manual(values = c('#FF3333','#3399FF'))
Wealth per capita
ggplot(df, aes(x = year, colour = country)) + geom_line(aes(y = df$employedPopulation)) + theme_bw() + guides(colour = guide_legend(title = NULL)) + labs(y = 'Employed Population in millions') + scale_colour_manual(values = c('#FF3333','#3399FF'))
Employment over time
M <- gvisMotionChart(df, idvar="population", timevar="year")
plot(M)