Sxy {desk}R Documentation

Variation and Covariation

Description

Calculates the variation of one variable or the covariation of two different variables.

Usage

Sxy(x, y = x, na.rm = FALSE)

Arguments

x

vector of one variable.

y

vector of another variable (optional). If specified then the covariation of x and y is calculated. If omitted then the variation of x is calculated.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

The variaion of x or the covariation of x and y.

Examples

x = c(1, 2)
y = c(4, 1)
Sxy(x) # variation
Sxy(x, y) # covariation

## Second example illustrating the na.rm option
x = c(1, 2, NA, 4)
Sxy(x)
Sxy(x, na.rm = TRUE)


[Package desk version 1.1.1 Index]