tidyr::gather vs. reshape2::melt on matrices
问题 I've been a long time user of reshape2::melt in a rather non-standard way: I'm running numeric experiments and get a matrix as a result. I then melt it and produce some images. Inspired by the similarity between reshape2 and tidyr , I'm now trying to achieve identical output on objects of class matrix. No luck so far: library(reshape2) library(tidyr) set.seed(42) mat <- matrix(runif(6), 3) mat2 <- mat colnames(mat2) <- letters[1:2] rownames(mat2) <- letters[3:5] melt(mat) melt(mat2) gather