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
mat2vec(ct, byrow = TRUE)
A list
with two elements
The vector
ized form the matrix ct
,
by default appending the rows of ct
The ct
)
whose i-th row corresponds to the i-th entry in vec
.
A matrix, in particular a contingency table
A logical argument (default=TRUE
).
If TRUE
, rows of ct
are appended to obtain the vector
and if FALSE
columns of ct
are appended to obtain the vector.
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)
Run the code above in your browser using DataLab