内容
CO2 emissions (metric tons per capita) :EN.ATM.CO2E.PC [Link]
Forest area (% of land area):AG.LND.FRST.ZS [Link]
Renewable electricity output (% of total electricity
output):EG.ELC.RNEW.ZS [Link]
Electricity production from oil, gas and coal sources (% of
total):EG.ELC.FOSL.ZS [Link]
Electricity production from nuclear sources (% of
total):EG.ELC.NUCL.ZS [Link]
df_environment <- WDI(
indicator = c(co2pcap = "EN.ATM.CO2E.PC",
forest = "AG.LND.FRST.ZS",
renewable = "EG.ELC.RNEW.ZS",
fossil = "EG.ELC.FOSL.ZS",
nuclea = "EG.ELC.NUCL.ZS"
), extra = TRUE)
write_csv(df_environment, "data/environment.csv")
df_environment <- read_csv("data/environment.csv")
Rows: 16758 Columns: 17── Column specification ───────────────────────────────────────────────────
Delimiter: ","
chr (7): country, iso2c, iso3c, region, capital, income, lending
dbl (8): year, co2pcap, forest, renewable, fossil, nuclea, longitude, ...
lgl (1): status
date (1): lastupdated
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
df_environment_long <- df_environment |>
pivot_longer(7:11, names_to = "name", values_to = "value")
df_environment_long |>
group_by(year, name) |> drop_na(value) |>
summarize(num = n()) |> arrange(desc(year))
`summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
df_environment_long |>
group_by(year, name) |> drop_na(value) |>
summarize(num = n()) |>
ggplot(aes(year, num, col = name)) + geom_line() +
labs(title = "各指標の年毎のデータ数", y = "データ数", x = "年")
`summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
World Development Indicators: [Link]
df_environment_long |>
filter(name %in% c("fossil", "renewable", "nuclea")) |>
filter(iso2c %in% c("1W", "ZF", "T6")) |> drop_na(value) |>
ggplot(aes(year, value, col = name, linetype = iso2c)) + geom_line()
LS0tCnRpdGxlOiAiR0VTIDAwMSDmvJTnv5I2IgphdXRob3I6ICJILiBTdXp1a2kiCmRhdGU6ICJgciBTeXMuRGF0ZSgpYCIKb3V0cHV0OgogIGh0b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