Getting Started with the kayadata Package"

knitr::opts_chunk$set(echo = FALSE)
library(dplyr)
library(kayadata)

kayadata

This package loads Kaya-identity data, synthesized from several sources.

To install and load the package, first install either the pacman or devtools package from CRAN:

install.packages("devtools")
devtools::install_github("jonathan-g/kayadata")
library(kayadata)

or

install.packages("pacman")
library(pacman)
p_load_gh("jonathan-g/kayadata")

Once you've installed it, then you just need to use the command library(kayadata) to load the package.

Some of the functions the package provides are:

mexico_data = get_kaya_data("Mexico") 
mexico_data %>% filter(year >= 1965) %>% 
  select(region:ef) %>%
  head()
mexico_2050 = project_top_down("Mexico", 2050)
mexico_2050
us_kaya = get_kaya_data("United States")
plot_kaya(us_kaya, "ef", y_lab = "Carbon intensity of economy",
          start_year = 2000, stop_year = 2010, log_scale = TRUE,
          trend_line = TRUE)
world_kaya = get_kaya_data("World")
plot_kaya(world_kaya, "P", start_year = 2000, stop_year = 2010, log_scale = FALSE,
          trend_line = FALSE)
mexico_mix = get_fuel_mix("Mexico")
mexico_mix
plot_fuel_mix(mexico_mix)

After you install the package, you can get more help inside RStudio by typing help(package="kayadata") in the R console window.



Try the kayadata package in your browser

Any scripts or data that you put into this service are public.

kayadata documentation built on Oct. 25, 2021, 9:07 a.m.