Learn R Programming

nlist (version 0.4.0)

aggregate.nlist: Aggregate nlist

Description

Aggregates an nlist_object() into a named list of numeric scalars.

Usage

# S3 method for nlist
aggregate(x, fun = mean, ...)

Value

An named list of numeric scalars

Arguments

x

An nlist object.

fun

A function that given a numeric vector returns a numeric scalar.

...

Additional arguments passed to fun.

See Also

Other aggregate: aggregate.nlists()

Examples

Run this code
aggregate(nlist(x = 1:9))
aggregate(nlist(y = 3:5, zz = matrix(1:9, 3)), fun = function(x) x[1])

Run the code above in your browser using DataLab