-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmanuscript.Rmd
More file actions
74 lines (59 loc) · 2.51 KB
/
manuscript.Rmd
File metadata and controls
74 lines (59 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
```{r setup, echo = FALSE, results='hide', message = FALSE, warning = FALSE}
opts_chunk$set(echo = FALSE)
invisible(sapply(list.files(path = "R", pattern = "R$", full.names = TRUE), source))
```
```{r author-info}
first_name <- "your first name"
last_name <- "your last name"
affiliation <- "your affiliation"
address <- "your address"
email <- "your email"
```
```{r manuscript_options}
break_year <- 1985
```
# Increase in life expectancy through time: a continental analysis
> By `r last_name`, `r first_name`
>
> Affiliation: `r affiliation`, `r address`
>
> Email: `r email`
In this paper, we will examine the change in life expectancy through time across
the five continents.
```{r summary}
gdp <- gather_gdp_data("data-raw")
latest_lifeExp <- get_latest_lifeExp(gdp)
mean_lifeExp <- get_mean_lifeExp(gdp)
coef_before_after <- get_coef_before_after(mean_lifeExp, break_year)
```
## The situation
There are important disparities in life expectancy across the five
continents. It ranges from `r min(latest_lifeExp[["latest_lifeExp"]])`
in `r latest_lifeExp[["continent"]][which.min(latest_lifeExp$latest_lifeExp)]`,
to `r max(latest_lifeExp[["latest_lifeExp"]])`
in `r latest_lifeExp[["continent"]][which.max(latest_lifeExp$latest_lifeExp)]`.
These disparities are also reflected in the increases in life expectancy between
`r min(gdp$year)` and `r max(gdp$year)`.
```{r lifeExp-trends-per-continent}
plot_summary_lifeExp_by_continent(mean_lifeExp)
```
To investigate these differences in more detail, we compared the rate of increase
for the periods `r min(gdp$year)`-`r manuscript_options()$year`
and `r manuscript_options()$year`-`r max(gdp$year)`
```{r change_trend}
plot_change_trend(mean_lifeExp, manuscript_options()$year)
```
```{r change-trend}
change_trend <- coef_before_after %>% group_by(continent) %>% summarize(diff = trend[2] - trend[1])
largest_neg_change_index <- which.min(change_trend$diff)
largest_pos_change_index <- which.max(change_trend$diff)
least_change_index <- which.min(abs(change_trend$diff))
```
The largest negative change is observed for `r change_trend$continent[largest_neg_change_index]` with a
decrease of `r change_trend$diff[largest_neg_change_index]`.year<sup>-1</sup>
between the two time periods; while `r change_trend$continent[largest_pos_change_index]`
experienced the largest increase with a difference of
`r change_trend$diff[largest_pos_change_index]`.year<sup>-1</sup> during the
same interval.
`r change_trend$continent[least_change_index]` stayed the most constant between the
two time periods.