Warning: There was 1 warning in `mutate()`.
ℹ In argument: `iso3c = country_name_regex_to_iso3c(country_name)`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Micronesia
Download data for export emissions for each country from 1995-2018
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `iso3c = country_name_regex_to_iso3c(country_name)`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Rest of the World
Show the code
scope_1_export <- scope_1_export|>na.omit()
Combine domestic emissions and export emissions to generate the complete scope 1 emissions data.
Show the code
scope_1_complete <-full_join(raw_domestic_scope_1, scope_1_export, by =c("year"="year", "country_name"="country_name", "iso3c"="iso3c"))
Download data for scope 2 emissions for each country from 1995-2018
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `iso3c = country_name_regex_to_iso3c(country_name)`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Türkiye
Omit missing data
Show the code
scope_2 <- scope_2 |>na.omit()
Read data for scope 3 emissions for each country from 1995-2018 (here I did the manual calculation for scope 3 emissions in excel).
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `iso3c = country_name_regex_to_iso3c(country_name)`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Türkiye
Omit missing data
Show the code
scope_3 <- scope_3 |>na.omit()
Combine scope 1 and scope 2 data
Show the code
combine_scopes_1_2 <-full_join(scope_1_complete, scope_2, by =c("year"="year", "country_name"="country_name", "iso3c"="iso3c"))
Combine scope 1, 2 and 3 data
Show the code
complete_all_scopes_data <-full_join(combine_scopes_1_2, scope_3, by =c("year"="year", "country_name"="country_name", "iso3c"="iso3c"))
Clean dataset to remove those with years without all kinds of emissions
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `iso3c = country_name_regex_to_iso3c(country_name)`.
Caused by warning in `countrycode_convert()`:
! Some values were not matched unambiguously: Africa Eastern and Southern, Africa Western and Central, Arab World, Caribbean small states, Central Europe and the Baltics, Channel Islands, Early-demographic dividend, East Asia & Pacific, East Asia & Pacific (excluding high income), East Asia & Pacific (IDA & IBRD countries), Euro area, Europe & Central Asia, Europe & Central Asia (excluding high income), Europe & Central Asia (IDA & IBRD countries), European Union, Fragile and conflict affected situations, Heavily indebted poor countries (HIPC), High income, IBRD only, IDA & IBRD total, IDA blend, IDA only, IDA total, Kosovo, Late-demographic dividend, Latin America & Caribbean, Latin America & Caribbean (excluding high income), Latin America & the Caribbean (IDA & IBRD countries), Least developed countries: UN classification, Low & middle income, Low income, Lower middle income, Middle East & North Africa, Middle East & North Africa (excluding high income), Middle East & North Africa (IDA & IBRD countries), Middle income, North America, Not classified, OECD members, Other small states, Pacific island small states, Post-demographic dividend, Pre-demographic dividend, Small states, South Asia, South Asia (IDA & IBRD), Sub-Saharan Africa, Sub-Saharan Africa (excluding high income), Sub-Saharan Africa (IDA & IBRD countries), Turkiye, Upper middle income, World
Add PPP-GDP data to data set with scope 1-3 emissions
Show the code
scopes_GDP_PPP <-full_join(complete_all_scopes_data, ppp_gdp_data, by =c("year"="year", "country_name"="country_name", "iso3c"="iso3c"))
Warning in full_join(complete_all_scopes_data, ppp_gdp_data, by = c(year = "year", : Each row in `x` is expected to match at most 1 row in `y`.
ℹ Row 5313 of `x` matches multiple rows.
ℹ If multiple matches are expected, set `multiple = "all"` to silence this
warning.