Kcombination {ClusterStability}R Documentation

Kcombination returns the list of all possible combinations of a set of numbers of a given length k.

Description

This function, given a vector of numbers, will return all the possible combinations of a given length k.

Usage

Kcombination(data, k, selector)

Arguments

data

the vector of numbers (i.e. elements) to consider.

k

the length of the returned combination (between 2 and 6 in this version).

selector

if set, returns only the combinations containing this number.

Value

Return a list of all possible combinations for the given vector of numbers.

Examples

   ## Returns the k-combination of the list of numbers: 1,2,3 of length=2.
   ## i.e. (1,2), (1,3), (2,3) 
	Kcombination(c(1,2,3),k=2)
   ## Returns only the k-combination containing the number 1.
   ## i.e. (1,2), (1,3)	
	Kcombination(c(1,2,3),k=2,selector=1)

[Package ClusterStability version 1.0.4 Index]