RoC.fun: Calculates Rate of Change in simulated variables.

Description Usage Arguments Value Examples

View source: R/RoC.fun.R

Description

Takes the standard "full" output from one of the archSeries simulation functions and adds columns giving rates of change between bins, for all value columns or a specified subset. Called within simulation functions by setting their 'RoC' arguments to TRUE, but can also be called directly after the fact.

Usage

1
RoC.fun(results, field.list = NULL, type = "a")

Arguments

results

Data table resembling the first element ("full") of the output from one of the archSeries simulation functions.

field.list

Character vector of columns for which RoC should be calculated. Defaults to NULL, in which case all suitable columns are used.

type

Character: "a" for absolute change between bins; "r" for rate as a proportion of current value. Defaults to "a".

Value

The input data table with the addition of one new RoC column for each original value column.

Examples

1
2
3
date.ranges <- data.table(ID=c(1, 2, 3, 4), Start=c(450, 450, 600, 900), End=c(700, 800, 650, 1200))
results <- date.simulate(date.ranges, start.date=400, end.date=1200, bin.width=200)
x <- RoC.fun(results[[1]])

davidcorton/archSeries documentation built on May 4, 2021, 10:09 p.m.