sweep: sweep

sweepR Documentation

sweep

Description

Sweep a vector through a float matrix.

Usage

## S4 method for signature 'float32'
sweep(x, MARGIN, STATS, FUN = "-", check.margin = TRUE, ...)

Arguments

x

A float vector/matrix.

MARGIN

1 (rows) or 2 (columns)

STATS

Vector to sweep out.

FUN

Sweeping function; must be one of "+", "-", "*", or "/".

check.margin

Should x/STATS margin lengths be checked?

...

Theoretically these are additional arguments passed to an arbitrary function. However, we only support basic arithmetic, so they are ignored.

Details

Note that if the length of STATS does not recycle exactly across MARGIN, the results here will differ slightly from the results of base R.

Value

A matrix of the same type as the highest precision input.

Examples

library(float)

s = flrunif(10, 3)
sweep(s, 2, fl(1))


float documentation built on May 29, 2024, 8:13 a.m.