Permutate: Create k random permutations of a vector

Description Usage Arguments Details Author(s) Examples

View source: R/Permutate.R

Description

Creates a k random permutation of a vector.

Usage

1
Permutate(x, k)

Arguments

x

a vector to be permutated.

k

number of permutations to be conducted.

Details

should be used only for length(input)! >> k

Author(s)

Daniel Marcelino, dmarcelino@live.com.

Examples

1
2
3
#  5! = 5 x 4 x 3 x 2 x 1 = 120
# row wise permutations
Permutate(x=1:5, k=5)

Example output

Loading required package: ggplot2
SciencesPo 1.4.1

There are 120 possible outcomes, using 5 

     [,1] [,2] [,3] [,4] [,5]
[1,]    5    4    3    2    1
[2,]    5    1    2    3    4
[3,]    2    4    3    5    1
[4,]    2    3    5    1    4
[5,]    2    5    4    3    1

SciencesPo documentation built on May 29, 2017, 9:28 p.m.