Programmer Guide/Command Reference/EVAL/shuffle: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
:;''x'': the set to be shuffled; must be a vector or matrix | :;''x'': the set to be shuffled; must be a vector or matrix | ||
:;''n'': the number of row exchanges applied top ''x''; <code>0 < ''n''</code> (default=<code>nrow(''x'')/2) | :;''n'': the number of row exchanges applied top ''x''; <code>0 < ''n''</code> (default=<code>nrow(''x'')/2) | ||
:;''once'': | :;''once'': change row position only once | ||
::''once''==0: the number of exchanges of a row is not limited | |||
::''once''!=0: the number of exchanges of a row is limited to 1 | |||
:;''seed'': if this value is not equal ''0'', it is used to initialize the random number generator used to select the rows to be exchanged | :;''seed'': if this value is not equal ''0'', it is used to initialize the random number generator used to select the rows to be exchanged | ||
;Result: The result has the same type and content as ''x'', but the order of the rows is changed (''shuffeld'') randomized. | |||
;See also: [[Programmer_Guide/Command_Reference/EVAL/rand|rand]], [[Programmer_Guide/Command_Reference/EVAL/sample|grand]], [[Programmer_Guide/Command_Reference/EVAL/sample|sample]] | |||
;See also: [[Programmer_Guide/Command_Reference/EVAL/rand|rand]], [[Programmer_Guide/Command_Reference/EVAL/sample|grand]], [[Programmer_Guide/Command_Reference/EVAL/ | |||
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] | [[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] |
Revision as of 16:06, 8 April 2011
Create a shuffled version of a set.
- Usage
shuffle(x {, n {, once { seed}}})
- x
- the set to be shuffled; must be a vector or matrix
- n
- the number of row exchanges applied top x;
0 < n
(default=nrow(x)/2)
- once
- change row position only once
- once==0: the number of exchanges of a row is not limited
- once!=0: the number of exchanges of a row is limited to 1
- seed
- if this value is not equal 0, it is used to initialize the random number generator used to select the rows to be exchanged
- Result
- The result has the same type and content as x, but the order of the rows is changed (shuffeld) randomized.