This a generic question, let' say I have:
matrix=replicate(5, rnorm(10))
I want a data.frame with 3 columns: row number, column number, matrix value.
What you are looking for is melt
inside library(reshape)
melt(matrix)
edit: use reshape2
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With