R: Possible arrangements by row a matrix, where NA values are...
multCh7SM
R Documentation
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)
Arguments
our.matrix
The matrix containing the data (including NA values) which will be rearranged by row.
Details
The computations involved get very time consuming very quickly, so be careful not to use it for too large of a matrix.
Value
Returns an array, containing k1!*k2!*...*kn! distinct matrices of the same size as our.matrix
Author(s)
Grant Schneider
Examples
##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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(NSM3)
Loading required package: combinat
Attaching package: 'combinat'
The following object is masked from 'package:utils':
combn
Loading required package: MASS
Loading required package: partitions
Loading required package: survival
fANCOVA 0.5-1 loaded
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/NSM3/multCh7SM.Rd_%03d_medium.png", width=480, height=480)
> ### Name: multCh7SM
> ### Title: Possible arrangements by row a matrix, where NA values are
> ### ignored
> ### Aliases: multCh7SM
> ### Keywords: Row arrangements NA fixed
>
> ### ** Examples
>
> ##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)
, , 1
[,1] [,2] [,3]
[1,] NA 1 2
[2,] 1 2 3
[3,] NA NA 1
, , 2
[,1] [,2] [,3]
[1,] NA 2 1
[2,] 1 2 3
[3,] NA NA 1
, , 3
[,1] [,2] [,3]
[1,] NA 1 2
[2,] 1 3 2
[3,] NA NA 1
, , 4
[,1] [,2] [,3]
[1,] NA 2 1
[2,] 1 3 2
[3,] NA NA 1
, , 5
[,1] [,2] [,3]
[1,] NA 1 2
[2,] 3 1 2
[3,] NA NA 1
, , 6
[,1] [,2] [,3]
[1,] NA 2 1
[2,] 3 1 2
[3,] NA NA 1
, , 7
[,1] [,2] [,3]
[1,] NA 1 2
[2,] 3 2 1
[3,] NA NA 1
, , 8
[,1] [,2] [,3]
[1,] NA 2 1
[2,] 3 2 1
[3,] NA NA 1
, , 9
[,1] [,2] [,3]
[1,] NA 1 2
[2,] 2 3 1
[3,] NA NA 1
, , 10
[,1] [,2] [,3]
[1,] NA 2 1
[2,] 2 3 1
[3,] NA NA 1
, , 11
[,1] [,2] [,3]
[1,] NA 1 2
[2,] 2 1 3
[3,] NA NA 1
, , 12
[,1] [,2] [,3]
[1,] NA 2 1
[2,] 2 1 3
[3,] NA NA 1
>
>
>
>
>
> dev.off()
null device
1
>