fm.aggR Documentation

Aggregation on a FlashR object.

Description

This function accepts a basic operator and perform aggregation on the FlashR object with the basic operator.

Usage

fm.agg(fm, op)

fm.agg.lazy(fm, op)

fm.agg.mat(fm, margin, op)

fm.agg.mat.lazy(fm, margin, op)

Arguments

fm

a FlashR object

op

the reference or the name of a predefined basic operator or the reference to an aggregation operator returned by fm.create.agg.op.

margin

the subscript which the function will be applied over.

Details

fm.agg aggregates over the entire object.

fm.agg.lazy aggregates over the entire object, but it performs aggregation lazily.

fm.agg.mat aggregates on the rows or columns of a matrix. It performs aggregation on the shorter dimension lazily, but on the longer dimension immediately.

fm.agg.mat.lazy aggregates on the rows or columns of a matrix and performs aggregation lazily regardless the dimension.

Value

fm.agg returns a scalar, fm.agg.mat returns a FlashR vector, fm.agg.lazy and fm.agg.mat.lazy return a FlashR sink matrix.

Examples

mat <- fm.runif.matrix(100, 2)
res <- fm.agg(mat, "+")
res <- fm.agg(mat, fm.bo.add)
sum <- fm.create.agg.op(fm.bo.add, fm.bo.add, "sum")
res <- fm.agg(mat, sum)
res <- fm.agg.mat(mat, 1, sum)