## ----setup, include=FALSE----------------------------------------------------- knitr::opts_chunk$set(echo = TRUE) ## ----leaders------------------------------------------------------------------ library(MaddisonData) Leaders0 <- MaddisonData::MaddisonLeaders() Leaders00 <- table(Leaders0$ISO) MaddisonData::MaddisonCountries[names(Leaders00), 1:2] ## ----leaders1----------------------------------------------------------------- Leaders1 <- MaddisonData::MaddisonLeaders(c('ARE', 'KWT', 'QAT')) Leaders10 <- table(Leaders1$ISO) MaddisonData::MaddisonCountries[names(Leaders10), 1:2] ## ----plotMad------------------------------------------------------------------ #library(MaddisonData) Leaders10d <- subset(MaddisonData, ISO %in% names(Leaders10)) plotLeaders1 <- MaddisonData::ggplotPath(y='gdppc', group='ISO', data=Leaders10d, scaley=1000) plotLeaders1 plotLeaders1 + ggplot2::xlim(1200, 2022) ## ----MadSources--------------------------------------------------------------- MadSources15 <- MaddisonData::getMaddisonSources(names(Leaders10)) head(MadSources15) ## ----plotDur------------------------------------------------------------------ plot(yearEnd-yearBegin+1~yearBegin, Leaders1, log='y', las=1) Leaders1$dYrs0 <- with(Leaders1, yearEnd-yearBegin+1) Leaders1$dYrs1 <- c(tail(Leaders1$yearBegin, -1) - head(Leaders1$yearEnd, -1), NA) Leaders1 tail(Leaders1) ## ----plotMad1600-------------------------------------------------------------- MadDat1600 <- subset(MaddisonData::MaddisonData, year>1600) Leaders1600 <- MaddisonData::MaddisonLeaders(c('ARE', 'KWT', 'QAT'), data=MadDat1600) table(Leaders1600$ISO) Leaders1600d <- subset(MaddisonData, ISO %in% names(table(Leaders1600$ISO))) plotLeaders1600 <- MaddisonData::ggplotPath(y='gdppc', group='ISO', data=Leaders1600d, scaley=1000) plotLeaders1600 + ggplot2::xlim(1601, 2022) ## ----NLD_GBR_USA-------------------------------------------------------------- NLD_GBR_USAd <- subset(MaddisonData, ISO %in% c("NLD", 'GBR', 'USA')) NLD_GBR_USA <- ggplotPath(y='gdppc', group='ISO', data=NLD_GBR_USAd, scaley=1000) NLD_GBR_USA + ggplot2::xlim(1301, 2022) NLD_GBR_USA + ggplot2::xlim(1601, 2022) ## ----UKevents1, eval=FALSE---------------------------------------------------- # UKevents1 <- matrix(c( # "1066-10-14", "Norman Conquest", # '1215-06-16', 'Magna Carta' # ), ncol=2) ## ----1250_1350, eval=FALSE---------------------------------------------------- # GBRgdppc + ggplot2::coord_cartesian(xlim=c(1250, 1350), ylim=c(0.9, 2)) ## ----UKevents2, eval=FALSE---------------------------------------------------- # UKevents2 <- rbind(UKevents1, # c("1348-06", "Black Death") ) # # GBR <- subset(MaddisonData, (ISO == 'GBR') & (1347