mosaic (version 0.14.4)

MAD: All pairs mean and sum of absolute differences

Description

All pairs mean and sum of absolute differences

Usage

MAD(x, ..., data = NULL, groups = NULL, na.rm = getOption("na.rm", FALSE))

SAD(x, ..., data = NULL, groups = NULL, na.rm = getOption("na.rm", FALSE))

Arguments

x

a numeric vector or a formula.

...

additional arguments passed through to MAD_ or SAD_. If x is a formala, ... should include an argument named data if the intent is to interpret the formala in a data frame.

data

a data frame in which to evaluate formulas (or bare names). Note that the default is data=parent.frame(). This makes it convenient to use this function interactively by treating the working envionment as if it were a data frame. But this may not be appropriate for programming uses. When programming, it is best to use an explicit data argument -- ideally supplying a data frame that contains the variables mentioned.

groups

a grouping variable, typically a name of a variable in data

na.rm

a logical indicating whether NAs should be removed before calculaing.

Value

the mean or sum of the absolute differences between each pair of values in c(x,...).

See Also

link{mad}, MAD_

Examples

Run this code
# NOT RUN {
SAD(1:3)
MAD(1:3)
MAD(~eruptions, data=faithful)
# }

Run the code above in your browser using DataCamp Workspace