knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

toolR

Travis build status AppVeyor build status

ToolR provides basic functionality for economists. Package currently only allows CPI price conversions.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("bdempe18/toolR")

Rebase

Rebase convert prices listed in a base year's USD to its equivalent value in a desired year.

library(toolR)

prices_2000 <- c(100,200,300)
prices_2010 <- toolR::rebase(prices_2000, in_yr = 2000, to_yr = 2010)
prices_2010

Rebase supports vectorized operations. A sequence of prices and base years can be converted to a common year.

prices <- runif(10, 50, 100)
yrs <- 2000:2009
rebase(price=prices, in_yr = yrs, to_yr = 2012)

Rebase can be used in conjunction with dplyr to convert a data frame column to a common year.

suppressPackageStartupMessages(library(dplyr))

df <- data.frame(yr = 2000:2009, prices = runif(10, 50, 100))
df %>% mutate(prices15 = rebase(price = prices, in_yr = yr, to_yr = 2015))


bdempe18/toolR documentation built on June 14, 2019, 12:03 a.m.