title: "Subject 2: Purchasing power of English workers from the 16th to the 19th century"
author: "Your name"
author: "Oussama Oulkaid"
date: "Today's date"
date: "November 28, 2021"
output: html_document
output:
pdf_document: default
html_document:
df_print: paged
---
---
```{r setup, include=FALSE}
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(echo = TRUE)
options(warn = -1)
```
```
## Some explanations
## Preamble
This is an R Markdown document that you can easily export to HTML, PDF, and MS Word formats. For more information on R Markdown, see <http://rmarkdown.rstudio.com>.
Ceci est un document R markdown que vous pouvez aisément exporter au format HTML, PDF, et MS Word. Pour plus de détails sur R Markdown consultez <http://rmarkdown.rstudio.com>.
When you click on the button **Knit**, the document will be compiled in order to re-execute the R code and to include the results into the final document. As we have shown in the video, R code is inserted as follows:
Lorsque vous cliquerez sur le bouton **Knit** ce document sera compilé afin de ré-exécuter le code R et d'inclure les résultats dans un document final. Comme nous vous l'avons montré dans la vidéo, on inclue du code R de la façon suivante:
```{r cars}
We will need to use the following libraries:
summary(cars)
```{r, results=FALSE, message=FALSE}
# The environment
library(tidyverse)
library(ggplot2)
library(reshape2)
library(Hmisc)
```
```
It is also straightforward to include figures. For example:
## Build the data frame
From the following link we have downloaded the data we are going to work with in the form of a csv file, and make it into data/ forlder: <https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Wheat.csv>
<!-- describe(df) -->
We assign it to a data frame as follows:
```{r, message=FALSE}
df <- read.csv("data/Wheat.csv",header=T)
df[c(1,2),]
```
```{r pressure, echo=FALSE}
## Clean the data frame
plot(pressure)
We observe that the first column indicates a sort of an identifier for each data sample. This is not an interesting parameter, so we can simply omit it:
```{r, message=FALSE}
#only keep columns from 2 to 4 (column 1 is omitted)
df <- df[c(2:4)]
df[c(1,2),]
```
```
Note the parameter `echo = FALSE` that indicates that the code will not appear in the final version of the document. We recommend not to use this parameter in the context of this MOOC, because we want your data analyses to be perfectly transparent and reproducible.
## Plotting
```{r, message=FALSE}
# set some parameters
wages_color <- "#ff5733"
wheat_color <- rgb(0.2, 0.6, 0.9, 1)
wheat_color_trans <- rgb(0.2, 0.6, 0.9, 0.5)
# Start with a usual ggplot2 call:
ggplot(df, aes(x=Year)) +
geom_point( aes(y=Wages), size = 0.7, color = wages_color) +
geom_point( aes(y=Wheat/1.5), size = 0.7, color = wheat_color) +
geom_line( aes(y=Wages), size = 0.3, color = wages_color, linetype="dashed") +
geom_line( aes(y=Wheat/1.5), size = 0.3, color = wheat_color, linetype="dashed") +
Since the results are not stored in Rmd files, you should generate an HTML or PDF version of your exercises and commit them. Otherwise reading and checking your analysis will be difficult for anyone else but you.
**Comment:** TBD
Now it's your turn! You can delete all this information and replace it by your computational document.