View source: R/NNCTFunctions.r
mat2vec | R Documentation |
Converts the contingency table (or any matrix) ct
to a vector
by default row-wise (i.e., by appending
each row one after the other) or column-wise, and also returns the entry indices (in the original matrix ct
)
in a k^2 \times 2 matrix
mat2vec(ct, byrow = TRUE)
ct |
A matrix, in particular a contingency table |
byrow |
A logical argument (default= |
A list
with two elements
vec |
The |
ind |
The k^2 \times 2 matrix of entry indices (in the original matrix |
Elvan Ceyhan
ind.nnsym
and ind.seg.coeff
,
n<-20 #or try sample(1:20,1) Y<-matrix(runif(3*n),ncol=3) ipd<-ipd.mat(Y) cls<-sample(1:2,n,replace = TRUE) #or try cls<-rep(1:2,c(10,10)) ct<-nnct(ipd,cls) ct mat2vec(ct) mat2vec(ct,byrow=FALSE) #an arbitrary 3x3 matrix M<-matrix(sample(10:20,9),ncol=3) M mat2vec(M) mat2vec(M,byrow=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.