Skip to content
Snippets Groups Projects
Commit 2a1a8a95 authored by Ben Anderson's avatar Ben Anderson
Browse files

fixed code errors and adjusted selections

parent 3e36e7d7
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
This diff is collapsed.
...@@ -46,7 +46,8 @@ Who do we care about? ...@@ -46,7 +46,8 @@ Who do we care about?
```{r} ```{r}
#| label: selectEntities #| label: selectEntities
entities_of_interest <- c("United Kingdom", "United States", "New Zealand", "China") entities_of_interest <- c("United Kingdom", "United States", "New Zealand",
"China")
``` ```
# Absolute GDP & emissions # Absolute GDP & emissions
...@@ -99,6 +100,8 @@ First we'll try production emissions. ...@@ -99,6 +100,8 @@ First we'll try production emissions.
#| fig-cap: GDP vs production emissions over time (selected entities) #| fig-cap: GDP vs production emissions over time (selected entities)
#| warning: false #| warning: false
entities_of_interest <- c(entities_of_interest, "World")
plotDT <- dt_pc[Entity %in% entities_of_interest] plotDT <- dt_pc[Entity %in% entities_of_interest]
ggplot2::ggplot(plotDT, aes(y = as.numeric(`GDP per capita, PPP (constant 2017 international $)`), ggplot2::ggplot(plotDT, aes(y = as.numeric(`GDP per capita, PPP (constant 2017 international $)`),
...@@ -106,7 +109,6 @@ ggplot2::ggplot(plotDT, aes(y = as.numeric(`GDP per capita, PPP (constant 2017 i ...@@ -106,7 +109,6 @@ ggplot2::ggplot(plotDT, aes(y = as.numeric(`GDP per capita, PPP (constant 2017 i
colour = Entity, colour = Entity,
alpha = Year)) + alpha = Year)) +
geom_point() + geom_point() +
theme(legend.position = "none") +
labs(x = "Annual CO2 emissions per capita (production-based, T)", labs(x = "Annual CO2 emissions per capita (production-based, T)",
y = "GDP per capita (constant 2017 $)") y = "GDP per capita (constant 2017 $)")
...@@ -168,6 +170,7 @@ p <- ggplot2::ggplot(plotDT, aes(y = as.numeric(`GDP per capita, PPP (constant 2 ...@@ -168,6 +170,7 @@ p <- ggplot2::ggplot(plotDT, aes(y = as.numeric(`GDP per capita, PPP (constant 2
colour = Entity, colour = Entity,
alpha = Year)) + alpha = Year)) +
geom_point() + geom_point() +
theme(legend.position = "none") +
labs(x = "Annual CO2 emissions per capita (consumption-based, T)", labs(x = "Annual CO2 emissions per capita (consumption-based, T)",
y = "GDP per capita (constant 2017 $)") y = "GDP per capita (constant 2017 $)")
...@@ -183,8 +186,6 @@ Following <https://timjackson.org.uk/earth-vs-growth/> ... ...@@ -183,8 +186,6 @@ Following <https://timjackson.org.uk/earth-vs-growth/> ...
```{r} ```{r}
#| label: selectProduction #| label: selectProduction
dt_abs[, `Emissions intensity` := `Annual CO2 emissions`/`GDP, PPP (constant 2017 international $)`*1000*1000] dt_abs[, `Emissions intensity` := `Annual CO2 emissions`/`GDP, PPP (constant 2017 international $)`*1000*1000]
entities_of_interest <- c("United Kingdom", "United States", "World", "New Zealand", "China")
``` ```
```{r} ```{r}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment