--- title: "purchasing power of English workers from the 16th to the 19th century" author: "Zhijun ZHEN" date: "31 March 2020" output: html_document: default pdf_document: default --- ## Initialisation ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) library(ggplot2) library(wesanderson) library(gridExtra) jeuB<-read.csv(file="jeuB.csv", header=TRUE) ``` ## Question one Reproduction of the Playfair graph from numerical data. The data used are in the file "subject2.csv" (located in the same directory as this file). We start first with 2 graphs separating the price of wheat per year and the weekly salary per year. ```{r} line1 <- ggplot(data = jeuB, aes(x=Year, y=Wheat)) + geom_bar(colour="black", stat="identity") + labs (x="Year", y="Price of the quarter of wheats in shillings") + theme_bw() line2 <- ggplot(jeuB, aes(x=Year, y=Wages))+ geom_area(color="red", fill="lightblue") + labs (x="Year", y="Weekly wage in shillings") + theme_bw() grid.arrange(line1, line2) ``` We now merge the 2 previous graphics into one: ```{r} ggplot(jeuB) + geom_bar(aes(x=Year, y=Wheat), stat = "identity", colour="black") + geom_area(aes(x=Year, y=Wages), fill="lightblue", alpha=0.7) + geom_line(aes(x=Year, y=Wages), color="red") + ggtitle("Playfair plot") + labs(x="Year", y= "Weekly wage in shillings") + scale_y_continuous(sec.axis = sec_axis(~.+0, name = "Price of the quarter of wheats in shillings"), position = "left") + theme_bw() ``` ## Question two Improved presentation of data. The unit "shillings per quarter of bushel of wheat" is replaced by "shillings per kg of wheat" and "shillings per week" by "shillings per year" (leap years will not be taken into account here). ```{r} ggplot(jeuB) + geom_bar(aes(x=Year, y=Wheat/6.8), stat = "identity", colour="black") + labs(x="Year", y= "Yearly wage in shillings") + geom_area(aes(x=Year, y=Wages*52), fill="lightblue", alpha=0.7) + geom_line(aes(x=Year, y=Wages*52), color="red") + ggtitle("Playfair plot") + scale_y_continuous(sec.axis = sec_axis(~.+0, name = "Wheat price per kg in shillings"), position = "left") + theme_bw() ``` In this form, the graph is not very relevant: we do not observe the relationship between the 2 units used and the evolution of the price of wheat is invisible. Consequently, we modify the graph in order to obtain a more relevant scale for the price of wheat. ```{r} ggplot(jeuB) + geom_bar(aes(x=Year, y=(Wheat/6.8)*200), stat = "identity", colour="black") + labs(x="Year", y= "Yearly wage in shillings") + geom_area(aes(x=Year, y=Wages*52), fill="lightblue", alpha=0.7) + geom_line(aes(x=Year, y=Wages*52), color="red") + ggtitle("Playfair plot") + scale_y_continuous(sec.axis = sec_axis(~./200, name = "Wheat price per kg in shillings"), position = "left") + theme_bw() ``` ## Question three Here we will make a graphical representation of the purchasing power of workers over time. First, we define purchasing power as the quantity of wheat that a worker can buy with his weekly salary. ```{r} ggplot(data = jeuB, aes(x=Year, y=Wages/(Wheat/6.8))) + geom_line(color="red") + labs (x="Year", y="Quantity of wheat (in kg) that a worker can weekly buy") + ggtitle("Evolution of the spending power during time") + theme_bw() ``` On this graph, we observe that the purchasing power of the workers increases gradually over time, until about the 1730s when it begins to stagnate, then to decrease around the 1780s. However, even with this decrease, purchasing power remains significantly higher than in the years before 1700. We then observe the evolution of the price of wheat as a function of (annual) wages. ```{r} ggplot(data = jeuB, aes(x=Wages*52, y=Wheat/6.8)) + geom_point(aes(color = cut(Year, c(-Inf, 1700, 1730, 1780, Inf)))) + scale_color_manual(name = "Year", values=wes_palette(n=4, name="FantasticFox1"), labels = c("before 1700", "between 1700 and 1730", "between 1730 and 1780", "after 1780")) + geom_smooth(fill="lightgrey") + labs (x="Yearly wage in shillings", y="Wheat price per kg in shillings") + ggtitle("Evolution of the price of the wheat depending on the wages") + theme_bw() ``` On the graph above, it seems that the higher the price of wheat (per kilo), the more the wages are too. According to the Playfair graph, this is explained by the fact that wages increase over time. The same goes for the price of wheat but unevenly for it. According to the data, workers' wages increase over time without an exceptional moment. In the graph below, we have therefore replaced the time axis with that of the annual salary. ```{r} ggplot(data = jeuB, aes(x=Wages*52, y=Wages/(Wheat/6.8))) + geom_line(color="blue") + labs (x="Yearly wage in shillings", y="Quantity of wheat (in kg) that a worker can weekly buy") + ggtitle("Evolution of the spending power depending on the wages") + theme_bw() ``` Here we find a curve showing an evolution in the purchasing power of workers in the same idea as the first graph. However, the significant increase in purchasing power is less evident here. If we want to show that the purchasing power of workers increases over time, we therefore find that the first curve is the most relevant among these graphs.