R: Kcombination returns the list of all possible combinations of...
Kcombination
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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ClusterStability)
Loading required package: Rcpp
Loading required package: clusterCrit
Loading required package: cluster
Loading required package: copula
Loading required package: WeightedCluster
Loading required package: TraMineR
TraMineR stable version 1.8-12 (Built: 2016-07-02)
Website: http://traminer.unige.ch
Please type 'citation("TraMineR")' for citation information.
This is WeightedCluster stable version 1.2 (Built: 2016-07-02)
To get the manuals, please run:
vignette("WeightedCluster") ## Complete manual in English
vignette("WeightedClusterFR") ## Complete manual in French
vignette("WeightedClusterPreview") ## Short preview in English
To cite WeightedCluster in publications please use:
Studer, Matthias (2013). WeightedCluster Library Manual: A practical guide to
creating typologies of trajectories in the social sciences with R.
LIVES Working Papers, 24. doi: 10.12682/lives.2296-1658.2013.24
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ClusterStability/Kcombination.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Kcombination
> ### Title: Kcombination returns the list of all possible combinations of a
> ### set of numbers of a given length _k_.
> ### Aliases: Kcombination
> ### Keywords: k-combination
>
> ### ** 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)
[[1]]
[1] 1 2
[[2]]
[1] 1 3
[[3]]
[1] 2 3
> ## Returns only the k-combination containing the number 1.
> ## i.e. (1,2), (1,3)
> Kcombination(c(1,2,3),k=2,selector=1)
[[1]]
[1] 1 2
[[2]]
[1] 1 3
>
>
>
>
>
> dev.off()
null device
1
>