Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
0c2d387b484b42dc06d4c28dcae352b6
mooc-rr
Commits
934b1468
Commit
934b1468
authored
Dec 01, 2021
by
0c2d387b484b42dc06d4c28dcae352b6
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace exercice_en.Rmd
parent
01d56d75
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
exercice_en.Rmd
module3/exo3/exercice_en.Rmd
+10
-7
No files found.
module3/exo3/exercice_en.Rmd
View file @
934b1468
...
@@ -45,8 +45,8 @@ df <- df[c(2:4)]
...
@@ -45,8 +45,8 @@ df <- df[c(2:4)]
df[c(1,2),]
df[c(1,2),]
```
```
## Reproducing Playfair's graph
##
1.
Reproducing Playfair's graph
**!!TODO : perform required transformations in terms of wheat-price & salary**
<!-- **!!TODO : perform required transformations in terms of wheat-price & salary** -->
```{r, message=FALSE}
```{r, message=FALSE}
# create a list of colors
# create a list of colors
my_colors <- list( blue = "#3399e6",
my_colors <- list( blue = "#3399e6",
...
@@ -65,9 +65,9 @@ ggplot(df, aes(x=Year)) +
...
@@ -65,9 +65,9 @@ ggplot(df, aes(x=Year)) +
# Custom the Y scales:
# Custom the Y scales:
scale_y_continuous(
scale_y_continuous(
# Features of the first axis
# Features of the first axis
name = "Wages",
name = "Wages
(in Shillings per week)
",
# Add a second axis and specify its features
# Add a second axis and specify its features
sec.axis = sec_axis( trans=~.*1.5, name="Wheat Price")
sec.axis = sec_axis( trans=~.*1.5, name="Wheat Price
(in Shillings per quarter)
")
) +
) +
labs(title = "Evolution of wages and wheat price for English workers (16th to 19th century)") +
labs(title = "Evolution of wages and wheat price for English workers (16th to 19th century)") +
theme(plot.title = element_text(hjust = 0.5),
theme(plot.title = element_text(hjust = 0.5),
...
@@ -75,7 +75,7 @@ ggplot(df, aes(x=Year)) +
...
@@ -75,7 +75,7 @@ ggplot(df, aes(x=Year)) +
axis.title.y.right = element_text(colour = my_colors[["dark"]]))
axis.title.y.right = element_text(colour = my_colors[["dark"]]))
```
```
## Alternative representation
##
2.
Alternative representation
First, we represent the data as simple dots for both wages and wheat price.
First, we represent the data as simple dots for both wages and wheat price.
As it is difficult to see the pattern for the wheat values evolution, we use the `stat_smooth()` function that shows a smoothed mean.
As it is difficult to see the pattern for the wheat values evolution, we use the `stat_smooth()` function that shows a smoothed mean.
...
@@ -96,10 +96,10 @@ ggplot(df, aes(x=Year)) +
...
@@ -96,10 +96,10 @@ ggplot(df, aes(x=Year)) +
# Custom the Y scales:
# Custom the Y scales:
scale_y_continuous(
scale_y_continuous(
# Features of the first axis
# Features of the first axis
name = "Wages",
name = "Wages
(in Shillings per week)
",
# Add a second axis and specify its features
# Add a second axis and specify its features
sec.axis = sec_axis( trans=~.*1.5, name="Wheat")
sec.axis = sec_axis( trans=~.*1.5, name="Wheat
(in Shillings per quarter)
")
) +
) +
labs(title = "Evolution of wages and wheat price for English workers (16th to 19th century)") +
labs(title = "Evolution of wages and wheat price for English workers (16th to 19th century)") +
theme(plot.title = element_text(hjust = 0.5),
theme(plot.title = element_text(hjust = 0.5),
...
@@ -107,4 +107,7 @@ ggplot(df, aes(x=Year)) +
...
@@ -107,4 +107,7 @@ ggplot(df, aes(x=Year)) +
axis.title.y.right = element_text(colour = wheat_color))
axis.title.y.right = element_text(colour = wheat_color))
```
```
## 3. Another Representation without an explicit time axis
TBD
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment