ratx: Take consecutive ratios of a vector.

View source: R/utils.R

ratxR Documentation

Take consecutive ratios of a vector.

Description

This can be used, for example to take survival ratios.

Usage

ratx(fx, k = 1)

Arguments

fx

numeric. Vector of length > k.

k

integer. The size of the lag in elements of fx.

Details

Behavior similar to diff(), in that returned vector is k elements shorter than the given vector fx.

Examples

fx <- 1:10
ratx(fx)
ratx(fx,-1)
ratx(fx,0)

timriffe/DemoTools documentation built on Jan. 28, 2024, 5:13 a.m.