Warning: package 'rnaturalearth' was built under R version 4.1.3
library(countrycode)
Warning: package 'countrycode' was built under R version 4.1.3
library(wbstats)
Warning: package 'wbstats' was built under R version 4.1.3
library(ggplot2)library(gganimate)
Warning: package 'gganimate' was built under R version 4.1.3
#install.packages('gganimate')library(gapminder)
Warning: package 'gapminder' was built under R version 4.1.3
#install.packages('gifski')library(gifski)
Warning: package 'gifski' was built under R version 4.1.3
renewable_energy <-read_csv("00_data_raw/Renewable Energy by year and country.csv")
New names:
Rows: 18374 Columns: 8
-- Column specification
-------------------------------------------------------- Delimiter: "," chr
(6): LOCATION, INDICATOR, SUBJECT, MEASURE, FREQUENCY, ...8 dbl (2): TIME,
Value
i Use `spec()` to retrieve the full column specification for this data. i
Specify the column types or set `show_col_types = FALSE` to quiet this message.
* `` -> `...8`
Warning in countrycode_convert(sourcevar = sourcevar, origin = origin, destination = dest, : Some values were not matched unambiguously: EU28, G20, OEU, WLD
renewable_energy <- renewable_energy %>%na.omit()
co2_emissions <-read_csv("00_data_raw/CO2 Emissions by country and year .csv")
New names:
Rows: 2980 Columns: 8
-- Column specification
-------------------------------------------------------- Delimiter: "," chr
(6): LOCATION, INDICATOR, SUBJECT, MEASURE, FREQUENCY, ...8 dbl (2): TIME,
Value
i Use `spec()` to retrieve the full column specification for this data. i
Specify the column types or set `show_col_types = FALSE` to quiet this message.
* `` -> `...8`
Rows: 1523 Columns: 36
-- Column specification --------------------------------------------------------
Delimiter: ","
chr (9): Country, ISO2, ISO3, Indicator, Source, CTS_Code, CTS_Name, CTS_Fu...
dbl (27): F1995, F1996, F1997, F1998, F1999, F2000, F2001, F2002, F2003, F20...
i Use `spec()` to retrieve the full column specification for this data.
i Specify the column types or set `show_col_types = FALSE` to quiet this message.
Environmental_Protection_Expenditures <- Environmental_Protection_Expenditures |>rowwise() |>mutate(total_percent_gdp =sum(`Expenditure on biodiversity & landscape protection`, `Expenditure on environment protection`, `Expenditure on environmental protection n.e.c.`, `Expenditure on environmental protection R&D`, `Expenditure on pollution abatement`, `Expenditure on waste management`, `Expenditure on waste water management`, na.rm =TRUE))
clean_dataset <-left_join(depedent_variables, green_bonds, by =c("year"="year", "country_name"="country_name", "iso3c"="iso3c"))
clean_dataset
# A tibble: 7,167 x 14
iso3c year energy_ktoe country_name emission_mln_ton `Expenditure on biodi~`
<chr> <dbl> <dbl> <chr> <dbl> <dbl>
1 AUS 1960 4438. Australia NA NA
2 AUS 1961 4491. Australia NA NA
3 AUS 1962 4408. Australia NA NA
4 AUS 1963 4629. Australia NA NA
5 AUS 1964 4498. Australia NA NA
6 AUS 1965 4717. Australia NA NA
7 AUS 1966 4446. Australia NA NA
8 AUS 1967 4575. Australia NA NA
9 AUS 1968 4473. Australia NA NA
10 AUS 1969 4526. Australia NA NA
# ... with 7,157 more rows, and 8 more variables:
# `Expenditure on environment protection` <dbl>,
# `Expenditure on environmental protection n.e.c.` <dbl>,
# `Expenditure on environmental protection R&D` <dbl>,
# `Expenditure on pollution abatement` <dbl>,
# `Expenditure on waste management` <dbl>,
# `Expenditure on waste water management` <dbl>, total_percent_gdp <dbl>, ...
dataset_countries <-subset(clean_dataset, country_name %in%c("France", "Germany", "Italy", "Netherlands", "Spain", "United Kingdom", "United States", "Brazil", "Chile", "China", "India", "Mexico", "Turkey", "United Arab Emirates", "Hong Kong SAR China", "Singapore"))
Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
parametric, : reciprocal condition number 0
Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
parametric, : There are other near singularities as well. 0.25
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
-0.024892
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
0.52489
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
number 0
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : There are other near
singularities as well. 0.25
Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
parametric, : reciprocal condition number 0
Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
parametric, : There are other near singularities as well. 0.25
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
-0.024892
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
0.52489
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
number 0
Warning in predLoess(object$y, object$x, newx = if
(is.null(newdata)) object$x else if (is.data.frame(newdata))
as.matrix(model.frame(delete.response(terms(object)), : There are other near
singularities as well. 0.25