exchange | R Documentation |
exchange
returns a new matrix by switching two randomly selected elements from a user-defined matrix
exchange(X, j, type = "col")
X |
A matrix object. In general, |
j |
A positive integer, which stands for the jth column (or row) of |
type |
An exchange type. If |
If all inputs are logical, then the output will be a new design matrix after the exchange.
#create a toy LHD with 5 rows and 3 columns
toy=rLHD(n=5,k=3);toy
#Choose the first column of toy and exchange two randomly selected elements.
try.col=exchange(X=toy,j=1,type="col")
toy;try.col
#Choose the first row of toy and exchange two randomly selected elements.
try.row=exchange(X=toy,j=1,type="row")
toy;try.row
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.