variance: Variance

Description Usage Arguments Value Examples

View source: R/metrics.R

Description

Variance

Usage

1
variance(x, margin = 2L)

Arguments

x

a numeric vector, matrix, or data.frame.

margin

In case of matrix or dataframe apply variance by columns margin = 2L or by rows margin = 1L. Default 2.

Value

the sample variance of the input.

Examples

1
2
3
4
5
6
example1 <- data.frame("V1" = rep(1, 100), "V2" = 100:1,  "V4" = sample.int(3000,100,replace=FALSE))
example2 <- rep(1, 100)

variance(example1)
variance(example1, margin = 1L)
variance(example2)

AnderEhu/sme documentation built on Jan. 31, 2022, 12:01 a.m.