Learn R Programming

RMVL (version 1.1.0.1)

mvl_group_lapply: Apply function to index stretches

Description

Iteratively call function fn(idx) over index stretches previously computed with mvl_group

Usage

mvl_group_lapply(G, fn)

Value

a list of results of function fn

Arguments

G

a list of groups and group stretches produced by mvl_group

fn

a function of one argument - list of indices

See Also

mvl_group

Examples

Run this code
if (FALSE) {
Mtmp<-mvl_open("tmp_a.mvl", append=TRUE, create=TRUE)
mvl_write_object(Mtmp, data.frame(x=rep(c("a", "b"), 50), y=(1:100)/5), "df1")
Mtmp<-mvl_remap(Mtmp)
df1<-Mtmp$df1
G<-mvl_group(list(df1[,"x",ref=TRUE], df1[,"y", ref=TRUE]))
mvl_group_lapply(G, function(idx) { return(sum(df1[idx, "y"]))})
}

Run the code above in your browser using DataLab