Learn R Programming

kStatistics (version 2.0)

m2Set: Multiset To Set

Description

Transform a multiset in a set.

Usage

m2Set( v )

Arguments

v

multiset structure of type [[e1,e2,...], m1], [[f1,f2,...], m2],... with m1, m2 multiplicities

Value

set

sequence of distinct elements

Details

Consider the multiset [a,a,b]. The subdivisions are [[[a,b],[a]],2],[[[a],[a],[b]],1], [[a,a,b],1], [[a,a],[b],1]. m2Set(c(2,1)) deletes block repetitions, that is transforms the given list in [a,b],[a],[b],[a,a,b],[a,a], according to the order given in the input. See also the examples.

See Also

list2m, list2Set

Examples

Run this code
# NOT RUN {
M1 <- mkmSet(c(2,1))
# 
# M1 is the multiset of subdivisions
# [ 
#   [[1,1],[1,0]], 2], 
#   [[1,0],[1,0],[0,1]], 1),
#   [[2,1]], 1], 
#   [[2,0],[0,1]], 1]
# ]
# 

# Return the following set:  [[1,1],[1,0],[0,1],[2,1],[2,0]] 
m2Set( M1 )

# }

Run the code above in your browser using DataLab