Skip to content
Prev 139301 / 398506 Next

Converting a data frame with values into a matrix/

Oops, I just realised that you asked for a matrix not
a data.frame  Substituing for the last three lines of
code

final <- as.matrix(aba)
colnames(final)  <-  aa$Name
rownames(final) <- mm1$Class

should do it.
--- John Kane <jrkrideau at yahoo.ca> wrote:

            
=====================================================
matrix(1,length(unique(xx$Class)),length(unique(xx[,1])))
[[elided trailing spam]]