Learn R Programming

float (version 0.3-2)

sweep: sweep

Description

Sweep a vector through a float matrix.

Usage

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

Value

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

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.

Examples

Run this code
library(float)

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

Run the code above in your browser using DataLab