difs: Functions for evaluating distance between variables

Description Usage Arguments Value Examples

Description

Functions for evaluating distance between variables

Usage

1
2
3
4
5
dif(x, y, var)

rev_dif(x, y, var)

rev_difv(x, var)

Arguments

x, y

variables to be compared

var

variable code

Value

Difference or ratio of x and y (for dif) and sum or product (for rev_dif and rev_difv). Distance is measured as difference for variables included in getOption('additive_variables'), i.e. temperature (TAS) by default, and as a ratio for other variables.

While rev_dif returns sum(x, y) or prod(x, y), rev_difv takes single vector x and returns sum(x) or prod(x).

Used mainly in other functions of the package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
getOption('additive_variables')

# calculate distance of 2 vectors
dif(c(10, 20, 30), c(11, 18, 3), 'TAS')
dif(c(10, 20, 30), c(11, 18, 3), 'PR')

# inverse for 2 vectors
rev_dif(c(10, 20, 30), c(11, 18, 3), 'TAS')

# inverse for 1 vector
rev_difv(c(10, 1.1, .9), 'TAS')

musica documentation built on May 2, 2019, 10:14 a.m.