Learn R Programming

NSM3 (version 1.18)

multCh7SM: Possible arrangements by row a matrix, where NA values are ignored

Description

Similar to multCh7, this function will generate all of the possible arrangements of the data by row within a matrix, except for NA values, which will remain fixed. This function is used in pSkilMack and cSkilMack to generate the Exact distribution. For a given matrix of with k1,...kn non-missing values, this will give k1!*k2!*...*kn! possible arrangements

Usage

multCh7SM(our.matrix)

Value

Returns an array, containing k1!*k2!*...*kn! distinct matrices of the same size as our.matrix

Arguments

our.matrix

The matrix containing the data (including NA values) which will be rearranged by row.

Author

Grant Schneider

Details

The computations involved get very time consuming very quickly, so be careful not to use it for too large of a matrix.

Examples

Run this code
##Get a matrix with some NA's
our.matrix<-matrix(c(NA,1,2,3,5,7,NA,NA,11),ncol=3,byrow=TRUE)
##Get every possible arrangement by row, treating the NA's as fixed
multCh7SM(our.matrix)

Run the code above in your browser using DataLab