list2m: List To Multiset

list2mR Documentation

List To Multiset

Description

The function returns the multiset representation of a vector or a list, in increasing order.

Usage

list2m( v=c(0) ) 

Arguments

v

single vector or list of vectors

Details

Given a list in input, the list2m function returns a structure as [[e1,e2,...], m1], [[f1,f2,...], m2],... where m1, m2,... are the instances of c(e1,e2,...), c(f1,f2,...), ... in the input vector v.

Value

multiset

the list of multisets

Note

Called by the countP function in the kStatistics package.

Author(s)

Elvira Di Nardo elvira.dinardo@unito.it,
Giuseppe Guarino giuseppe.guarino@rete.basilicata.it

References

D.E. Knuth (1998) The Art of Computer Programming. (3rd ed.) Addison Wesley.

See Also

list2Set, m2Set, countP

Examples


# Return the list of multisets [[1],3], [[2],1] from the input vector (1,2,1,1)  
list2m(c(1,2,1,1 )) 

# Return the list of multisets [[1,2],2], [[2,3],1] from the input list (c(1,2),c(2,3),c(1,2))  
list2m(list(c(1,2),c(2,3),c(1,2))) 


kStatistics documentation built on June 8, 2022, 5:05 p.m.