Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `country_name = countrycode(sourcevar = Name, origin =
"country.name", destination = "country.name")`.
Caused by warning:
! Some values were not matched unambiguously: Int. Aviation, Int. Shipping, Virgin Islands_USA
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
library(dplyr)year_cols <-grep("^Y_[0-9]{4}$", names(EDGAR_CO2_data), value =TRUE)print(year_cols)
Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `country_name = countrycode(sourcevar = Country, origin =
"country.name", destination = "country.name")`.
Caused by warning:
! Some values were not matched unambiguously: APEC: Asia-Pacific Economic Cooperation, ASEAN: Association of South East Asian Nations, EA19: Euro area (19 countries), EASIA: Eastern Asia, EU13: EU28 excluding EU15, EU15: European Union (15 countries), EU27_2020: European Union (27 countries), EU28: European Union (28 countries), G20: Group of Twenty, NONOECD: Non-OECD economies and aggregates, OECD: OECD member countries, ROW: Rest of the World, WLD: World, ZASI: East and Southeastern Asia, ZEUR: Europe, ZNAM: North America, ZOTH: Other regions, ZSCA: South and Central America
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `country_name = countrycode(sourcevar = Country, origin =
"country.name", destination = "country.name")`.
Caused by warning:
! Some values were not matched unambiguously: APEC: Asia-Pacific Economic Cooperation, ASEAN: Association of South East Asian Nations, EA19: Euro area (19 countries), EASIA: Eastern Asia, EU13: EU28 excluding EU15, EU15: European Union (15 countries), EU27_2020: European Union (27 countries), EU28: European Union (28 countries), G20: Group of Twenty, NONOECD: Non-OECD economies and aggregates, OECD: OECD member countries, ROW: Rest of the World, WLD: World, ZASI: East and Southeastern Asia, ZEUR: Europe, ZNAM: North America, ZOTH: Other regions, ZSCA: South and Central America
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
year_cols <-grep("^[0-9]{4}$", names(OECD_non_energy_import_data), value =TRUE)print(year_cols)OECD_non_energy_import_data_long <-OECD_non_energy_import_data |>pivot_longer(cols =all_of(year_cols), names_to ="year",values_to ="value" ) %>%mutate(year =as.integer(year), # Convert year to integerOECD_non_energy_import =as.numeric(value) # Convert value to numeric if not already )
library(tidyverse) library(readxl) library(here) library(countrycode)path_to_sheet4 <-"/Users/xingyuning/Desktop/susfin/find your data_raw data/OECD_D35Industry.xls"OECD_D35_import_data <-read_excel(path_to_sheet4, range ="A8:Z92")
Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `country_name = countrycode(sourcevar = Country, origin =
"country.name", destination = "country.name")`.
Caused by warning:
! Some values were not matched unambiguously: APEC: Asia-Pacific Economic Cooperation, ASEAN: Association of South East Asian Nations, EA19: Euro area (19 countries), EASIA: Eastern Asia, EU13: EU28 excluding EU15, EU15: European Union (15 countries), EU27_2020: European Union (27 countries), EU28: European Union (28 countries), G20: Group of Twenty, NONOECD: Non-OECD economies and aggregates, OECD: OECD member countries, ROW: Rest of the World, WLD: World, ZASI: East and Southeastern Asia, ZEUR: Europe, ZNAM: North America, ZOTH: Other regions, ZSCA: South and Central America
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
library(tidyverse) library(readxl) library(here) library(countrycode)path_to_sheet5 <-"/Users/xingyuning/Desktop/susfin/find your data_raw data/WB_GDP_adjustedbyPPP.xls"# Attempt to read the file againGDP_adjusted_PPP <-read_excel(path_to_sheet5, range ="A4:BO270")GDP_adjusted_PPP <- GDP_adjusted_PPP %>%mutate(country_name =countrycode(sourcevar = CountryName, origin ="country.name", destination ="country.name"),iso3c =countrycode(sourcevar = CountryName, origin ="country.name", destination ="iso3c") )
Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `country_name = countrycode(...)`.
Caused by warning:
! Some values were not matched unambiguously: Africa Eastern and Southern, Africa Western and Central, Arab World, Caribbean small states, Central Europe and the Baltics, 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, 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), Upper middle income, World
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
year_cols <-grep("^[0-9]{4}$", names(GDP_adjusted_PPP), value =TRUE)GDP_adjusted_PPP_long <-GDP_adjusted_PPP %>%pivot_longer(cols =all_of(year_cols), # Use all_of() to pivot only the year columns identified abovenames_to ="year",values_to ="value" ) %>%mutate(year =as.integer(year), GDP_adjusted_PPP =as.numeric(value) )
Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `country_name = countrycode(...)`.
Caused by warning:
! Some values were not matched unambiguously: Africa Eastern and Southern, Africa Western and Central, Arab World, Caribbean small states, Central Europe and the Baltics, 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, 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), Upper middle income, World
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
year_cols <-grep("^[0-9]{4}$", names(GDP_current_dollar), value =TRUE)GDP_current_dollar_long <-GDP_current_dollar %>%pivot_longer(cols =all_of(year_cols), # Use all_of() to pivot only the year columns identified abovenames_to ="year",values_to ="value" ) %>%mutate(year =as.integer(year), # Convert year to integerGDP_current_dollar =as.numeric(value) # Convert value to numeric if not already )
library(tidyverse) library(readxl) library(here) library(countrycode)path_to_sheet7 <-"/Users/xingyuning/Desktop/susfin/find your data_raw data/WB_Population.xls"# Attempt to read the file againpopulation <-read_excel(path_to_sheet7, range ="A4:B0270")population <- population %>%mutate(country_name =countrycode(sourcevar = CountryName, origin ="country.name", destination ="country.name"),iso3c =countrycode(sourcevar = CountryName, origin ="country.name", destination ="iso3c") )
Warning: There were 2 warnings in `mutate()`.
The first warning was:
ℹ In argument: `country_name = countrycode(...)`.
Caused by warning:
! Some values were not matched unambiguously: Africa Eastern and Southern, Africa Western and Central, Arab World, Caribbean small states, Central Europe and the Baltics, 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, 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), Upper middle income, World
ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
year_cols <-grep("^[0-9]{4}$", names(population), value =TRUE)population_long <-population %>%pivot_longer(cols =all_of(year_cols), names_to ="year",values_to ="value" ) %>%mutate(year =as.integer(year), population =as.numeric(value) )