get_indices: Create indices from columns in a dataframe given a baseline...

Description Usage Arguments Value

View source: R/indices.R

Description

Creates indices from a set of columns in a dataframe using a given row number, or vector of values, as the baseline. Use add_indices to append the indices to the input dataframe.

Usage

1
2
3
4
5
6
7
8
get_indices(
  data,
  from = 2,
  to = ncol(data),
  base = 100,
  baserow = 1,
  basevals = NULL
)

Arguments

data

A dataframe containing columns of numerical data to be expressed as indices.

from

The number or name of the column from which indices are calculated. The default is 2, assuming one column for row labels. Use 1 if there are no preceding data columns.

to

The number or name of the column to which indices are calculated. The default is ncol(data), which means indices are calculated across all remaining columms in the dataframe.

base

The baseline value of the created index. The default is 100. The base must be a positive number greater than zero.

baserow

The number of the row to be used as the baseline for calculating the indices. The default is 1. The baseline row must contain no zero values. This argument is ignored if the base values are set explicitly with basevals.

basevals

Specifies explicitly the values to use as the baseline when calculating the indices. Use this if the baseline values to be used are not represented in any given row. The default is NULL, which means the function will use the values in the baserow instead. The baseline values must not contain zeros.

Value

A tibble containing indices and any preceding columns.


olihawkins/cltools documentation built on Sept. 14, 2020, 7:25 a.m.