Entering edit mode
3.2 years ago
Riku
▴
80
Hi, all.
I will output MDS plot with ggplot2.
But, I couldn’t read the data because the class of the data wasn’t support in ggplot2. Is there a way to convert “dist” to “data.frame”?
Although I tried “as.data.frame()“, I was not able to do. The following error messages was outputed.
> as.data.frame(d)
Error in as.data.frame.default(d) :
cannot coerce class ‘"dist"’ to a data.frame
I'm a beginner in bioinformatics, so sorry for the basic question. Could you please advise me? Thank you very much for your appreciated!
I'd say the short answer is that you need to pass by
as.matrix
first:as.data.frame(as.matrix(d))
I was able to do it.
But, I can't make a graph Converting the distance matrix to dataframe type by this operation was not enough to output the MDS plot.
I will try another method. Thank you for your answer!
Note that there are
plotMDS
functions also in limma and edgeR that can make these plots directly from the normalized count data, but of course ggplot2 has the most appealing graphics.