Matrix2Df converts a matrix (e.g. result of base::table)
into a dataframe with the rownames as an additional first column ROW.
Matrix2Df(M) is ready to be pandered.
Matrix2Df(M)
Arguments
M
as a matrix
Value
dataframe
Examples
if (FALSE) {
x<-rep(LETTERS[1:3],each=20)
y<-rep(letters[1:5],12)
# Generate a matrix as it is tt<-Table(x,y,USENA=T)
ttis.matrix(tt)
data.frame(tt) # Not what we want!Matrix2Df(tt) # is a Data.frame that can be panderedM<-diag(10)
MMatrix2Df(M)
}