[ top | up ]

Sweep out Array Summaries

Syntax

apply(x, MARGIN, STATS, FUN="-", ...)

Arguments

x an array.
MARGIN a giving the extents of x which correspont to STATS.
STATS the summary statistic which is to be swept out.
FUN the function to be used to carry out the sweep. In the case of binary operators such as "/" etc., the function name must be quoted.
... optional arguments to FUN.

Value

Ans array with the same shape as x, but with the summary statistics swept out.

See Also

apply.

Examples

# subtract the column medians from a matrix sweep(x, 2, apply(x, 2, median))