LHD (version 0.1.0)

exchange: Exchange two random elements

Description

exchange returns a new design matrix after two randomly selected elements are switched from a user-defined column.

Usage

exchange(X, j)

Arguments

X

A Matrix.

j

A positive integer.

Value

If all inputs are logical, then the output will be a new design matrix after the exchange.

Details

  • X stands for the design matrix.

  • j is the j^th column of the design matrix, and it should be in [1,ncol(X)].

Examples

Run this code
# NOT RUN {
#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.
toy_new=exchange(X=toy,j=1)
toy;toy_new
# }

Run the code above in your browser using DataCamp Workspace