library(dplyr)
library(ggplot2)
library(stringr)
library(lubridate)
library(readxl)
library(visdat)
library(assertive)
ds1 <- read.csv("C:\\Users\\mari0\\OneDrive\\Documents\\R Studio\\Business analytics\\SP_WorldEnergy_file4.csv")
ds2 <- read.csv("C:\\Users\\mari0\\OneDrive\\Documents\\R Studio\\Business analytics\\SP_WorldEnergy_file6.csv")
ds3 <- read.csv("C:\\Users\\mari0\\OneDrive\\Documents\\R Studio\\Business analytics\\SP_WorldEnergy_file7.csv")
head(ds1, n = 9)
tail(ds1, n = 9)
tibble(ds2)
tail(ds2, n = 9)
summary(ds2)
X Country Energy_type Year Energy_consumption Energy_production
Min. : 0 Length:55440 Length:55440 Min. :1980 Min. : -0.163 Min. : 0.000
1st Qu.:13860 Class :character Class :character 1st Qu.:1990 1st Qu.: 0.000 1st Qu.: 0.000
Median :27720 Mode :character Mode :character Median :2000 Median : 0.018 Median : 0.001
Mean :27720 Mean :2000 Mean : 1.538 Mean : 1.533
3rd Qu.:41579 3rd Qu.:2009 3rd Qu.: 0.209 3rd Qu.: 0.113
Max. :55439 Max. :2019 Max. :601.040 Max. :611.509
NA's :11153 NA's :11151
GDP Population Energy_intensity_per_capita Energy_intensity_by_GDP CO2_emission
Min. : 0.12 Min. : 11 Min. : 0.00 Min. : 0.000 Min. : -0.01
1st Qu.: 9.74 1st Qu.: 1142 1st Qu.: 3.80 1st Qu.: 0.899 1st Qu.: 0.00
Median : 47.76 Median : 6158 Median : 29.78 Median : 2.988 Median : 0.00
Mean : 827.14 Mean : 62630 Mean : 71.90 Mean : 3.695 Mean : 78.80
3rd Qu.: 263.69 3rd Qu.: 20043 3rd Qu.: 95.52 3rd Qu.: 4.969 3rd Qu.: 4.32
Max. :127690.25 Max. :7714631 Max. :1139.32 Max. :166.914 Max. :35584.93
NA's :15414 NA's :9426 NA's :5082 NA's :5082 NA's :3826
The data set 2 includes the register for every country in each year from 1980 to 2019, indicating the energy consumption and production per energy type, the GDP and population of the country of the year corresponding to the register. This data set that has 11 columns and 55,439 rows.
Here’s a full description of all the columns: X: Number of register Country: Country name Energy_type: Type of energy Year: Year of report Energy_consumption: Amount of energy consumed (in kWh) Energy_production: Amount of energy produced (in kWh) GDP: Gross Domestic Product (in dollars) Population: Amount of citizens registered Energy_intensity_per_capita: Average consumption of energy per person (in kWh) Energy_intensity_by_GDP: energy consumption of per gross domestic production (in kWh) CO2_emission: Carbon dioxide emissions (in tonnes)
head(ds3, n = 9)
tail(ds3, n = 9)
summary(ds3)
Entity Code Year Electricity.from.coal..TWh. Electricity.from.gas..TWh.
Length:6241 Length:6241 Min. :1985 Min. : 0.00 Min. : 0.000
Class :character Class :character 1st Qu.:2000 1st Qu.: 0.00 1st Qu.: 0.000
Mode :character Mode :character Median :2007 Median : 0.00 Median : 1.057
Mean :2006 Mean : 142.85 Mean : 75.472
3rd Qu.:2013 3rd Qu.: 18.46 3rd Qu.: 27.354
Max. :2020 Max. :9345.34 Max. :5943.112
NA's :1020 NA's :1020
Electricity.from.hydro..TWh. Electricity.from.other.renewables..TWh. Electricity.from.solar..TWh.
Min. : 0.000 Min. : 0.0000 Min. : 0.000
1st Qu.: 0.018 1st Qu.: 0.0000 1st Qu.: 0.000
Median : 1.957 Median : 0.0100 Median : 0.000
Mean : 53.165 Mean : 5.8513 Mean : 2.015
3rd Qu.: 14.061 3rd Qu.: 0.6852 3rd Qu.: 0.009
Max. :4355.042 Max. :702.8876 Max. :844.386
NA's :35
Electricity.from.oil..TWh. Electricity.from.wind..TWh. Electricity.from.nuclear..TWh.
Min. : 0.0000 Min. : 0.0000 Min. : 0.00
1st Qu.: 0.0485 1st Qu.: 0.0000 1st Qu.: 0.00
Median : 1.0032 Median : 0.0000 Median : 0.00
Mean : 26.1108 Mean : 6.3162 Mean : 46.87
3rd Qu.: 9.1094 3rd Qu.: 0.0491 3rd Qu.: 0.00
Max. :1364.5782 Max. :1590.1894 Max. :2720.67
NA's :1020
The data set 3 includes the register for every country from 1985 to 2020, showing the amount of electricity from coal, gas, hydro, from other renewable, solar, oil, wind and nuclear in TWh. This data set has 11 columns and 6,241 rows.
1 TWh = 1,000,000,000 kWh (for reference)
Here’s a full description of all the columns: Entity: Country name Code: Country abbreviation code Year: Year of register Electricity.from.coal..TWh.: Amount of energy from coal (in TWh) Electricity.from.gas..TWh.: Amount of energy from gas (in TWh) Electricity.from.hydro..TWh.: Amount of energy from hydro (in TWh) Electricity.from.other.renewables..TWh.: Amount of energy from other renewables (in TWh) Electricity.from.solar..TWh.: Amount of energy from solar (in TWh) Electricity.from.oil..TWh.: Amount of energy from oil (in TWh) Electricity.from.wind..TWh.: Amount of energy from wind (in TWh) Electricity.from.nuclear..TWh.: Amount of energy from nuclear (in TWh)
sum(is.na(ds1_countries))
[1] 572
sapply(ds1_countries, function(x) sum(is.na(x)))
iso_code country year
0 0 0
coal_prod_change_pct coal_prod_change_twh gas_prod_change_pct
7 3 7
gas_prod_change_twh oil_prod_change_pct oil_prod_change_twh
3 7 3
energy_cons_change_pct energy_cons_change_twh biofuel_share_elec
3 3 0
biofuel_elec_per_capita biofuel_cons_change_pct biofuel_share_energy
0 14 7
biofuel_cons_change_twh biofuel_consumption biofuel_cons_per_capita
7 7 7
carbon_intensity_elec coal_share_elec coal_cons_change_pct
35 0 7
coal_share_energy coal_cons_change_twh coal_consumption
7 7 7
coal_elec_per_capita coal_cons_per_capita coal_production
0 7 3
coal_prod_per_capita electricity_generation biofuel_electricity
3 0 0
coal_electricity fossil_electricity gas_electricity
0 0 0
hydro_electricity nuclear_electricity oil_electricity
0 0 0
other_renewable_electricity other_renewable_exc_biofuel_electricity renewables_electricity
0 0 0
solar_electricity wind_electricity energy_per_gdp
0 0 15
energy_per_capita fossil_cons_change_pct fossil_share_energy
3 7 7
fossil_cons_change_twh fossil_fuel_consumption fossil_energy_per_capita
7 7 7
fossil_cons_per_capita fossil_share_elec gas_share_elec
0 0 0
gas_cons_change_pct gas_share_energy gas_cons_change_twh
7 7 7
gas_consumption gas_elec_per_capita gas_energy_per_capita
7 0 7
gas_production gas_prod_per_capita hydro_share_elec
3 3 0
hydro_cons_change_pct hydro_share_energy hydro_cons_change_twh
7 7 7
hydro_consumption hydro_elec_per_capita hydro_energy_per_capita
7 0 7
low_carbon_share_elec low_carbon_electricity low_carbon_elec_per_capita
0 0 0
low_carbon_cons_change_pct low_carbon_share_energy low_carbon_cons_change_twh
7 7 7
low_carbon_consumption low_carbon_energy_per_capita nuclear_share_elec
7 7 0
nuclear_cons_change_pct nuclear_share_energy nuclear_cons_change_twh
14 7 7
nuclear_consumption nuclear_elec_per_capita nuclear_energy_per_capita
7 0 7
oil_share_elec oil_cons_change_pct oil_share_energy
0 7 7
oil_cons_change_twh oil_consumption oil_elec_per_capita
7 7 0
oil_energy_per_capita oil_production oil_prod_per_capita
7 3 3
other_renewables_elec_per_capita other_renewables_share_elec other_renewables_cons_change_pct
0 0 14
other_renewables_share_energy other_renewables_cons_change_twh other_renewable_consumption
7 7 7
other_renewables_energy_per_capita per_capita_electricity population
7 0 0
primary_energy_consumption renewables_elec_per_capita renewables_share_elec
3 0 0
renewables_cons_change_pct renewables_share_energy renewables_cons_change_twh
7 7 7
renewables_consumption renewables_energy_per_capita solar_share_elec
7 7 0
solar_cons_change_pct solar_share_energy solar_cons_change_twh
7 7 7
solar_consumption solar_elec_per_capita solar_energy_per_capita
7 0 7
gdp wind_share_elec wind_cons_change_pct
15 0 13
wind_share_energy wind_cons_change_twh wind_consumption
7 7 7
wind_elec_per_capita wind_energy_per_capita
0 7
ds1_countries[duplicated(ds1_countries),]
summary(ds1_countries)
iso_code country year coal_prod_change_pct coal_prod_change_twh gas_prod_change_pct
Length:35 Length:35 Min. :2013 Min. :-49.242 Min. :-41.3060 Min. :-18.0970
Class :character Class :character 1st Qu.:2014 1st Qu.:-11.255 1st Qu.: -5.7942 1st Qu.: -4.7233
Mode :character Mode :character Median :2016 Median : -4.321 Median : -2.1515 Median : 1.6465
Mean :2016 Mean : -5.400 Mean : -4.0548 Mean : -0.3506
3rd Qu.:2018 3rd Qu.: 1.175 3rd Qu.: 0.2177 3rd Qu.: 3.7313
Max. :2019 Max. : 49.102 Max. : 15.0210 Max. : 13.4540
NA's :7 NA's :3 NA's :7
gas_prod_change_twh oil_prod_change_pct oil_prod_change_twh energy_cons_change_pct energy_cons_change_twh
Min. :-69.863 Min. :-38.349 Min. :-371.043 Min. :-14.0490 Min. :-111.424
1st Qu.:-14.904 1st Qu.: -6.668 1st Qu.: -74.528 1st Qu.: -1.6970 1st Qu.: -33.077
Median : 3.880 Median : -1.253 Median : 0.000 Median : 0.1550 Median : -0.987
Mean : 2.024 Mean : -2.221 Mean : -5.728 Mean : 0.1868 Mean : 0.841
3rd Qu.: 16.695 3rd Qu.: 5.073 3rd Qu.: 79.894 3rd Qu.: 1.8302 3rd Qu.: 32.983
Max. :110.486 Max. : 11.613 Max. : 260.717 Max. : 23.5630 Max. : 122.839
NA's :3 NA's :7 NA's :3 NA's :3 NA's :3
biofuel_share_elec biofuel_elec_per_capita biofuel_cons_change_pct biofuel_share_energy biofuel_cons_change_twh
Min. :0.000 Min. : 0.00 Min. :-9.155 Min. :0.0000 Min. :-20.295
1st Qu.:0.000 1st Qu.: 0.00 1st Qu.: 1.351 1st Qu.:0.0435 1st Qu.: 0.000
Median :0.506 Median : 12.44 Median : 5.557 Median :0.3165 Median : 0.125
Mean :2.160 Mean :107.09 Mean : 8.093 Mean :1.7515 Mean : 4.758
3rd Qu.:1.703 3rd Qu.:250.70 3rd Qu.:10.568 3rd Qu.:1.7005 3rd Qu.: 1.400
Max. :9.113 Max. :313.35 Max. :54.726 Max. :7.8630 Max. : 34.678
NA's :14 NA's :7 NA's :7
biofuel_consumption biofuel_cons_per_capita carbon_intensity_elec coal_share_elec coal_cons_change_pct
Min. : 0.0000 Min. : 0.00 Min. : NA Min. : 0.000 Min. :-34.351
1st Qu.: 0.9413 1st Qu.: 7.92 1st Qu.: NA 1st Qu.: 0.000 1st Qu.: -9.638
Median : 11.2640 Median : 295.22 Median : NA Median : 4.191 Median : -1.760
Mean : 59.7366 Mean : 413.28 Mean :NaN Mean : 4.542 Mean : -4.610
3rd Qu.: 59.8588 3rd Qu.: 678.29 3rd Qu.: NA 3rd Qu.: 8.911 3rd Qu.: 0.003
Max. :270.9240 Max. :1283.70 Max. : NA Max. :11.001 Max. : 22.208
NA's :7 NA's :7 NA's :35 NA's :7
coal_share_energy coal_cons_change_twh coal_consumption coal_elec_per_capita coal_cons_per_capita coal_production
Min. :0.142 Min. :-35.7690 Min. : 0.878 Min. : 0.0 Min. : 30.79 Min. : 0.000
1st Qu.:3.010 1st Qu.:-11.6982 1st Qu.:106.344 1st Qu.: 0.0 1st Qu.: 668.16 1st Qu.: 5.962
Median :5.713 Median : -0.5820 Median :167.149 Median : 117.4 Median :1054.99 Median : 38.035
Mean :4.586 Mean : -3.4067 Mean :139.371 Mean : 378.6 Mean :2005.49 Mean :107.010
3rd Qu.:6.341 3rd Qu.: 0.0045 3rd Qu.:197.396 3rd Qu.: 261.1 3rd Qu.:2099.38 3rd Qu.: 84.682
Max. :8.059 Max. : 32.1200 Max. :241.528 Max. :1747.8 Max. :6842.74 Max. :420.306
NA's :7 NA's :7 NA's :7 NA's :7 NA's :3
coal_prod_per_capita electricity_generation biofuel_electricity coal_electricity fossil_electricity gas_electricity
Min. : 0.0 Min. : 0.977 Min. : 0.000 Min. : 0.00 Min. : 0.764 Min. : 0.00
1st Qu.: 120.3 1st Qu.: 98.499 1st Qu.: 0.000 1st Qu.: 0.00 1st Qu.: 37.140 1st Qu.: 37.14
Median : 226.3 Median :302.900 Median : 1.534 Median :24.22 Median :100.169 Median : 53.88
Mean : 2451.4 Mean :324.992 Mean :12.375 Mean :21.85 Mean :101.094 Mean : 67.29
3rd Qu.: 701.0 3rd Qu.:584.786 3rd Qu.:10.809 3rd Qu.:31.62 3rd Qu.:127.022 3rd Qu.: 70.06
Max. :11907.7 Max. :645.838 Max. :54.514 Max. :61.69 Max. :250.723 Max. :188.10
NA's :3
hydro_electricity nuclear_electricity oil_electricity other_renewable_electricity
Min. : 0.07 Min. : 0.00 Min. : 0.000 Min. : 0.000
1st Qu.: 28.73 1st Qu.: 0.00 1st Qu.: 0.828 1st Qu.: 0.000
Median : 62.33 Median :10.88 Median : 4.666 Median : 7.364
Mean :170.89 Mean :24.35 Mean :11.953 Mean :13.653
3rd Qu.:378.18 3rd Qu.:15.10 3rd Qu.:25.392 3rd Qu.:11.419
Max. :393.90 Max. :98.59 Max. :45.570 Max. :54.514
other_renewable_exc_biofuel_electricity renewables_electricity solar_electricity wind_electricity energy_per_gdp
Min. :0.000 Min. : 0.071 Min. :0.001 Min. : 0.000 Min. :0.681
1st Qu.:0.000 1st Qu.: 47.084 1st Qu.:0.005 1st Qu.: 0.071 1st Qu.:1.098
Median :0.000 Median : 62.407 Median :0.085 Median : 8.453 Median :1.179
Mean :1.278 Mean :199.544 Mean :1.249 Mean :13.750 Mean :1.499
3rd Qu.:1.241 3rd Qu.:426.717 3rd Qu.:1.968 3rd Qu.:24.506 3rd Qu.:1.946
Max. :5.995 Max. :511.053 Max. :6.655 Max. :55.986 Max. :2.605
NA's :15
energy_per_capita fossil_cons_change_pct fossil_share_energy fossil_cons_change_twh fossil_fuel_consumption
Min. : 1063 Min. :-16.254 Min. :53.82 Min. :-150.134 Min. : 461.5
1st Qu.: 16546 1st Qu.: -3.332 1st Qu.:64.05 1st Qu.: -39.125 1st Qu.:1582.8
Median : 17671 Median : -1.159 Median :70.40 Median : -22.949 Median :1992.9
Mean : 37185 Mean : -1.702 Mean :73.80 Mean : -8.752 Mean :1793.8
3rd Qu.: 31919 3rd Qu.: 1.282 3rd Qu.:83.85 3rd Qu.: 28.093 3rd Qu.:2215.4
Max. :109291 Max. : 8.030 Max. :93.81 Max. : 151.465 Max. :2638.5
NA's :3 NA's :7 NA's :7 NA's :7 NA's :7
fossil_energy_per_capita fossil_cons_per_capita fossil_share_elec gas_share_elec gas_cons_change_pct gas_share_energy
Min. : 8786 Min. : 67.8 Min. :14.37 Min. : 0.000 Min. :-18.09700 Min. :10.39
1st Qu.:14145 1st Qu.: 432.7 1st Qu.:19.36 1st Qu.: 8.514 1st Qu.: 0.05275 1st Qu.:23.44
Median :16701 Median :1350.8 Median :40.37 Median :10.668 Median : 2.61750 Median :31.69
Mean :29557 Mean :1434.8 Mean :48.32 Mean :23.331 Mean : 1.17586 Mean :30.04
3rd Qu.:36609 3rd Qu.:1971.1 3rd Qu.:80.12 3rd Qu.:40.367 3rd Qu.: 5.39800 3rd Qu.:39.48
Max. :72033 Max. :3512.0 Max. :93.03 Max. :59.970 Max. : 17.82300 Max. :48.68
NA's :7 NA's :7 NA's :7
gas_cons_change_twh gas_consumption gas_elec_per_capita gas_energy_per_capita gas_production gas_prod_per_capita
Min. :-69.863 Min. : 264.6 Min. : 0.0 Min. : 1697 Min. : 0.0 Min. : 0
1st Qu.: 0.999 1st Qu.: 370.8 1st Qu.: 263.1 1st Qu.: 5435 1st Qu.: 249.0 1st Qu.: 1193
Median : 18.276 Median : 603.7 Median :1310.0 Median : 8192 Median : 345.9 Median : 4099
Mean : 12.569 Mean : 667.2 Mean : 936.2 Mean :12660 Mean : 586.8 Mean :13546
3rd Qu.: 30.320 3rd Qu.: 940.7 3rd Qu.:1470.6 3rd Qu.:17144 3rd Qu.: 516.0 3rd Qu.:12639
Max. : 89.575 Max. :1203.1 Max. :1768.4 Max. :32160 Max. :1790.3 Max. :48289
NA's :7 NA's :7 NA's :7 NA's :3 NA's :3
hydro_share_elec hydro_cons_change_pct hydro_share_energy hydro_cons_change_twh hydro_consumption hydro_elec_per_capita
Min. : 6.868 Min. :-27.036 Min. : 2.747 Min. :-68.787 Min. : 58.91 Min. : 6.484
1st Qu.:11.494 1st Qu.: -5.333 1st Qu.:15.171 1st Qu.:-23.225 1st Qu.: 130.97 1st Qu.: 237.232
Median :59.510 Median : -2.078 Median :24.009 Median : -6.763 Median : 561.80 Median : 1824.987
Mean :42.018 Mean : -2.029 Mean :19.431 Mean : -6.852 Mean : 544.74 Mean : 2958.969
3rd Qu.:62.421 3rd Qu.: 1.899 3rd Qu.:26.205 3rd Qu.: 6.012 3rd Qu.: 966.77 3rd Qu.: 2291.696
Max. :69.199 Max. : 37.966 Max. :29.708 Max. : 47.849 Max. :1003.08 Max. :10988.781
NA's :7 NA's :7 NA's :7 NA's :7
hydro_energy_per_capita low_carbon_share_elec low_carbon_electricity low_carbon_elec_per_capita
Min. : 461.8 Min. : 6.965 Min. : 0.071 Min. : 6.577
1st Qu.: 3543.7 1st Qu.:19.884 1st Qu.: 54.882 1st Qu.: 471.594
Median : 4941.2 Median :59.634 Median : 66.241 Median : 2090.617
Mean : 9457.3 Mean :51.685 Mean :223.898 Mean : 3858.033
3rd Qu.:11698.4 3rd Qu.:80.638 3rd Qu.:492.197 3rd Qu.: 2480.568
Max. :28418.1 Max. :85.631 Max. :532.227 Max. :14637.964
NA's :7
low_carbon_cons_change_pct low_carbon_share_energy low_carbon_cons_change_twh low_carbon_consumption
Min. :-16.4330 Min. : 6.185 Min. :-30.517 Min. : 132.9
1st Qu.: -2.0042 1st Qu.:16.145 1st Qu.: -7.984 1st Qu.: 157.7
Median : 0.7180 Median :29.599 Median : 4.285 Median : 770.5
Mean : 0.9732 Mean :26.202 Mean : 9.541 Mean : 775.0
3rd Qu.: 4.5210 3rd Qu.:35.947 3rd Qu.: 16.503 3rd Qu.:1348.2
Max. : 20.8280 Max. :46.178 Max. : 96.675 Max. :1591.0
NA's :7 NA's :7 NA's :7 NA's :7
low_carbon_energy_per_capita nuclear_share_elec nuclear_cons_change_pct nuclear_share_energy nuclear_cons_change_twh
Min. : 1119 Min. : 0.000 Min. :-18.480 Min. :0.0000 Min. :-15.3600
1st Qu.: 4036 1st Qu.: 0.000 1st Qu.: -4.251 1st Qu.:0.8227 1st Qu.: -1.8248
Median : 6614 Median : 2.570 Median : -0.963 Median :1.1895 Median : 0.0000
Mean :12769 Mean : 4.244 Mean : 1.645 Mean :2.2577 Mean : 0.3633
3rd Qu.:14609 3rd Qu.: 3.920 3rd Qu.: 3.092 3rd Qu.:2.7285 3rd Qu.: 0.7428
Max. :38158 Max. :15.493 Max. : 33.744 Max. :6.9560 Max. : 20.3460
NA's :7 NA's :14 NA's :7 NA's :7
nuclear_consumption nuclear_elec_per_capita nuclear_energy_per_capita oil_share_elec oil_cons_change_pct
Min. : 0.00 Min. : 0.00 Min. : 0.0 Min. : 0.0000 Min. :-15.6940
1st Qu.: 18.47 1st Qu.: 0.00 1st Qu.: 136.7 1st Qu.: 0.6745 1st Qu.: -5.6955
Median : 35.60 Median : 72.14 Median : 200.7 Median : 2.4730 Median : -2.6175
Mean : 80.93 Mean : 560.28 Mean :1866.7 Mean :20.4417 Mean : -3.5448
3rd Qu.: 92.17 3rd Qu.: 93.77 3rd Qu.:1864.4 3rd Qu.:11.6380 3rd Qu.: 0.7498
Max. :271.12 Max. :2764.36 Max. :7602.1 Max. :93.0350 Max. : 5.7530
NA's :7 NA's :7 NA's :7
oil_share_energy oil_cons_change_twh oil_consumption oil_elec_per_capita oil_energy_per_capita oil_production
Min. :31.23 Min. :-93.326 Min. : 196.1 Min. : 0.00 Min. : 6222 Min. : 0
1st Qu.:31.97 1st Qu.:-45.072 1st Qu.: 796.4 1st Qu.: 60.55 1st Qu.: 7247 1st Qu.:1234
Median :39.80 Median :-28.337 Median :1152.3 Median : 87.84 Median : 8547 Median :1553
Mean :39.17 Mean :-17.914 Mean : 987.2 Mean :120.04 Mean :14891 Mean :1519
3rd Qu.:43.93 3rd Qu.: 8.275 3rd Qu.:1282.0 3rd Qu.:150.35 3rd Qu.:19496 3rd Qu.:1677
Max. :50.73 Max. : 79.556 Max. :1507.1 Max. :383.50 Max. :34902 Max. :3191
NA's :7 NA's :7 NA's :7 NA's :7 NA's :3
oil_prod_per_capita other_renewables_elec_per_capita other_renewables_share_elec other_renewables_cons_change_pct
Min. : 0 Min. : 0.00 Min. :0.000 Min. :-11.771
1st Qu.: 7747 1st Qu.: 0.00 1st Qu.:0.000 1st Qu.: -2.096
Median :12688 Median : 59.82 Median :1.745 Median : 2.466
Mean :29926 Mean :120.70 Mean :2.558 Mean : 2.480
3rd Qu.:53579 3rd Qu.:255.08 3rd Qu.:2.539 3rd Qu.: 7.279
Max. :85305 Max. :352.35 Max. :9.113 Max. : 14.218
NA's :3 NA's :14
other_renewables_share_energy other_renewables_cons_change_twh other_renewable_consumption
Min. :0.0000 Min. :-3.3260 Min. : 0.00
1st Qu.:0.4695 1st Qu.: 0.0000 1st Qu.: 13.04
Median :0.7685 Median : 0.2395 Median : 22.13
Mean :1.3210 Mean : 1.7002 Mean : 42.95
3rd Qu.:1.4495 3rd Qu.: 2.8878 3rd Qu.: 47.65
Max. :4.0430 Max. :14.9150 Max. :139.30
NA's :7 NA's :7 NA's :7
other_renewables_energy_per_capita per_capita_electricity population primary_energy_consumption
Min. : 0.0 Min. : 88.54 Min. : 10401000 Min. : 11.06
1st Qu.:103.3 1st Qu.: 2396.43 1st Qu.: 29144500 1st Qu.: 893.97
Median :339.8 Median : 2782.45 Median : 36383000 Median :2169.27
Mean :373.8 Mean : 5292.81 Mean : 81220286 Mean :2249.24
3rd Qu.:663.3 3rd Qu.: 3733.88 3rd Qu.:125484000 3rd Qu.:3444.99
Max. :800.5 Max. :18141.45 Max. :211050000 Max. :3985.99
NA's :7 NA's :3
renewables_elec_per_capita renewables_share_elec renewables_cons_change_pct renewables_share_energy
Min. : 6.577 Min. : 6.965 Min. :-16.433 Min. : 4.779
1st Qu.: 384.058 1st Qu.:16.776 1st Qu.: -2.928 1st Qu.:15.821
Median : 2089.680 Median :59.634 Median : 1.470 Median :26.264
Mean : 3297.750 Mean :47.441 Mean : 1.188 Mean :23.944
3rd Qu.: 2444.500 3rd Qu.:67.582 3rd Qu.: 4.679 3rd Qu.:30.842
Max. :11899.597 Max. :83.050 Max. : 32.388 Max. :45.017
NA's :7 NA's :7
renewables_cons_change_twh renewables_consumption renewables_energy_per_capita solar_share_elec solar_cons_change_pct
Min. :-30.517 Min. : 102.7 Min. : 864.5 Min. :0.0010 Min. :-11.63
1st Qu.: -9.143 1st Qu.: 146.6 1st Qu.: 3981.3 1st Qu.:0.0085 1st Qu.: 11.32
Median : 4.559 Median : 635.6 Median : 6424.2 Median :0.1010 Median : 38.17
Mean : 9.178 Mean : 694.1 Mean :10902.6 Mean :0.2803 Mean :122.97
3rd Qu.: 19.781 3rd Qu.:1164.4 3rd Qu.:12804.0 3rd Qu.:0.4000 3rd Qu.:183.20
Max. : 97.068 Max. :1551.0 Max. :30707.7 Max. :2.1010 Max. :869.87
NA's :7 NA's :7 NA's :7 NA's :7
solar_share_energy solar_cons_change_twh solar_consumption solar_elec_per_capita solar_energy_per_capita
Min. :0.0000 Min. :-0.00300 Min. : 0.012 Min. : 0.025 Min. : 0.061
1st Qu.:0.0030 1st Qu.: 0.00925 1st Qu.: 0.028 1st Qu.: 0.191 1st Qu.: 0.825
Median :0.0290 Median : 0.19950 Median : 0.628 Median : 0.412 Median : 5.125
Mean :0.1484 Mean : 1.88661 Mean : 4.385 Mean : 21.161 Mean : 69.492
3rd Qu.:0.2167 3rd Qu.: 1.64225 3rd Qu.: 7.985 3rd Qu.: 24.028 3rd Qu.:119.352
Max. :1.4360 Max. :22.89900 Max. :30.802 Max. :114.191 Max. :285.589
NA's :7 NA's :7 NA's :7 NA's :7
gdp wind_share_elec wind_cons_change_pct wind_share_energy wind_cons_change_twh wind_consumption
Min. :1.625e+10 Min. :0.000 Min. :-100.000 Min. :0.0000 Min. :-0.6010 Min. : 0.000
1st Qu.:4.612e+11 1st Qu.:0.064 1st Qu.: 6.712 1st Qu.:0.3882 1st Qu.: 0.2752 1st Qu.: 8.126
Median :1.535e+12 Median :2.220 Median : 16.363 Median :1.1215 Median : 3.9020 Median : 29.805
Mean :1.376e+12 Mean :2.584 Mean : 23.597 Mean :1.2918 Mean : 7.6848 Mean : 42.245
3rd Qu.:1.865e+12 3rd Qu.:4.458 3rd Qu.: 34.946 3rd Qu.:2.0155 3rd Qu.:11.8447 3rd Qu.: 78.038
Max. :3.180e+12 Max. :9.098 Max. : 109.142 Max. :4.0130 Max. :35.6000 Max. :138.255
NA's :15 NA's :13 NA's :7 NA's :7 NA's :7
wind_elec_per_capita wind_energy_per_capita
Min. : 0.00 Min. : 0.00
1st Qu.: 2.37 1st Qu.: 66.02
Median : 60.22 Median : 235.28
Mean :196.92 Mean : 588.69
3rd Qu.:217.64 3rd Qu.: 693.42
Max. :886.15 Max. :2261.84
NA's :7
sum(is.na(ds2_countries))
[1] 28
sapply(ds2_countries, function(x) sum(is.na(x)))
X Country Energy_type Year
0 0 0 0
Energy_consumption Energy_production GDP Population
14 14 0 0
Energy_intensity_per_capita Energy_intensity_by_GDP CO2_emission
0 0 0
ds2_countries2[duplicated(ds2_countries2),]
summary(ds2_countries2)
X Country Energy_type Year Energy_consumption Energy_production
Min. :45894 Length:185 Length:185 Min. :2013 Min. : 0.000022 Min. : 0.0000
1st Qu.:47927 Class :character Class :character 1st Qu.:2014 1st Qu.: 0.416173 1st Qu.: 0.1498
Median :50459 Mode :character Mode :character Median :2016 Median : 1.081514 Median : 1.0814
Mean :50536 Mean :2016 Mean : 2.891884 Mean : 3.5463
3rd Qu.:52885 3rd Qu.:2018 3rd Qu.: 4.167638 3rd Qu.: 5.5986
Max. :55403 Max. :2019 Max. :15.167721 Max. :23.6138
GDP Population Energy_intensity_per_capita Energy_intensity_by_GDP CO2_emission
Min. : 29.79 Min. : 10401 Min. : 3.623 Min. : 1.265 Min. : 0.00
1st Qu.: 510.56 1st Qu.: 29851 1st Qu.: 60.111 1st Qu.: 3.491 1st Qu.: 0.00
Median :1705.81 Median : 37065 Median : 63.947 Median : 4.167 Median : 55.16
Mean :1653.94 Mean : 90085 Mean :140.530 Mean : 5.461 Mean :127.43
3rd Qu.:2388.54 3rd Qu.:127746 3rd Qu.:108.049 3rd Qu.: 8.619 3rd Qu.:218.34
Max. :3124.02 Max. :211246 Max. :420.104 Max. :12.871 Max. :613.09
sum(is.na(ds3_countries))
[1] 0
ds3_countries[duplicated(ds3_countries),]
summary(ds3_countries)
Entity Code Year Electricity.from.coal..TWh. Electricity.from.gas..TWh.
Length:35 Length:35 Min. :2013 Min. : 0.00 Min. : 0.00
Class :character Class :character 1st Qu.:2014 1st Qu.: 0.00 1st Qu.: 37.14
Mode :character Mode :character Median :2016 Median :24.22 Median : 53.88
Mean :2016 Mean :21.85 Mean : 67.29
3rd Qu.:2018 3rd Qu.:31.62 3rd Qu.: 70.06
Max. :2019 Max. :61.69 Max. :188.10
Electricity.from.hydro..TWh. Electricity.from.other.renewables..TWh. Electricity.from.solar..TWh.
Min. : 0.0703 Min. : 0.000 Min. :0.001
1st Qu.: 28.7330 1st Qu.: 0.000 1st Qu.:0.005
Median : 62.3290 Median : 7.364 Median :0.085
Mean :170.8922 Mean :13.653 Mean :1.249
3rd Qu.:378.1755 3rd Qu.:11.419 3rd Qu.:1.968
Max. :393.8980 Max. :54.514 Max. :6.655
Electricity.from.oil..TWh. Electricity.from.wind..TWh. Electricity.from.nuclear..TWh.
Min. : 0.0000 Min. : 0.000 Min. : 0.00
1st Qu.: 0.8281 1st Qu.: 0.071 1st Qu.: 0.00
Median : 4.6655 Median : 8.453 Median :10.88
Mean :11.9526 Mean :13.750 Mean :24.35
3rd Qu.:25.3925 3rd Qu.:24.506 3rd Qu.:15.10
Max. :45.5699 Max. :55.986 Max. :98.59
Data set 1
Data set 2
Data set 3