avgdist: Calculating Average Distance from the Mean

Description Usage Arguments Value Examples

Description

Calculates the average distance from the mean by converting each number in the vector to an absolute value and then taking the arithmetic mean.

Usage

1
avgdist(input, na.rm = FALSE)

Arguments

input

a vector of numbers

na.rm

true or false for whether to remove NA's before performing the calculation

Value

A number

Examples

1
2
3
4
5
6
7
8
a <- c(5,7,1,-3,-9)
avgdist(a)

b <- c(NA,4,7,-2,-12)
avgdist(b)

d <- c(NA,4,NA,-2,-12)
avgdist(d,na.rm=T)

Andy-McCarthy/BasicMath documentation built on May 27, 2019, 7:24 a.m.