mvl_group | R Documentation |
This function groups identical rows. The result is formatted as two vectors stretch_index
and index
Vector index
contains stretches of indices with identical rows. Vector stretch_index
describes stretches as stretch_index[i] to stretch_index[i+1]-1
This allows fast iteration over indices without creating excessive numbers of R objects when group sizes are small.
mvl_group(L, indices = NULL)
L |
list of vector like MVL_OBJECTs |
indices |
list of indices into objects to group. If absent or NULL it is assumed to be from 1 to the length of the object. |
A list of groups and group stretches
mvl_group_lapply
, mvl_hash_vectors
, mvl_find_matches
, mvl_order_vectors
, mvl_find_matches
, mvl_indexed_copy
, mvl_merge
## Not run:
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", ref=TRUE]
G<-mvl_group(list(df1[,"x",ref=TRUE], df1[,"y", ref=TRUE]))
mvl_group_lapply(G, function(idx) { return(sum(df1[idx, "y"]))})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.