knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
ToolR provides basic functionality for economists. Package currently only allows CPI price conversions.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("bdempe18/toolR")
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.