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) tt is.matrix(tt) data.frame(tt) # Not what we want! Matrix2Df(tt) # is a Data.frame that can be pandered M<-diag(10) M Matrix2Df(M) }