Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

calc_index

Index values


Description

Index numeric vector to first value. By default, the index base will be 0, turning regular values into percentage change. In some cases, you may want to index to a different base, like 100, such as if you're looking at financial data.

Usage

calc_index(m, base = 0)

Arguments

m

Numeric vector to index to first value.

base

Base to index against. (Default: 0)

Value

An vector of indexed values.

Examples

calc_index(c(5, 2, 8, 17, 7, 3, 1, -4))
calc_index(c(5, 2, 8, 17, 7, 3, 1, -4), base = 100)

upstartr

Utilities Powering the Globe and Mail's Data Journalism Template

v0.1.1
MIT + file LICENSE
Authors
Tom Cardoso [aut, cre] (creator and maintainer), Michael Pereira [ctb], The Globe and Mail Inc. [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.