Learn R Programming

kStatistics (version 1.0)

list2m: List To Multiset

Description

Generates a multiset from an array or a list, in increasing order.

Usage

list2m( v )

Arguments

v

single array or list of arrays

Value

multiset

list of multiset

Details

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

References

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

See Also

list2Set, m2Set, countP

Examples

Run this code
# NOT RUN {
list2m(c(1,2,1,1 )) 
# Converts the input array to the following multiset [[1],3],[[2],1]

list2m(list(c(1,2),c(2,3),c(1,2))) 
# Converts the input list to the following multiset [[1,2],2],[[2,3],1]

# }

Run the code above in your browser using DataLab