Hi all, I'm trying to use heat.map to display some data. The data is originally in csv format and when I read it in R using read.table I get: a b c d e 1 A 1 1 1 1 2 B 1 0 1 1 3 C 0 1 0 1 4 D 1 1 1 0 5 E 1 0 0 0 The problem is, that for heatmap I need a numerical matrix. When using data.matrix I get: a b c d e [1,] 1 1 1 1 1 [2,] 2 1 0 1 1 [3,] 3 0 1 0 1 [4,] 4 1 1 1 0 [5,] 5 1 0 0 0 So I get numerical... but I loss the row names. I would like to see these names as the y axis labels. What is the correct/easiest way of achieving this? Many thanks!!! -- View this message in context: http://n4.nabble.com/heatmap-image-from-csv-data-tp956968p956968.html Sent from the R help mailing list archive at Nabble.com.
On Dec 10, 2009, at 8:25 AM, Liat wrote:> > Hi all, > I'm trying to use heat.map to display some data. > The data is originally in csv format and when I read it in R using > read.table I get: > a b c d e > 1 A 1 1 1 1 > 2 B 1 0 1 1 > 3 C 0 1 0 1 > 4 D 1 1 1 0 > 5 E 1 0 0 0 > The problem is, that for heatmap I need a numerical matrix. When using > data.matrix I get: > a b c d e > [1,] 1 1 1 1 1 > [2,] 2 1 0 1 1 > [3,] 3 0 1 0 1 > [4,] 4 1 1 1 0 > [5,] 5 1 0 0 0 > So I get numerical... but I loss the row names. I would like to see > these > names as the y axis labels.Look (again?) at the help page for data.matrix.> What is the correct/easiest way of achieving this? > Many thanks!!! > -- > View this message in context: http://n4.nabble.com/heatmap-image-from-csv-data-tp956968p956968.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD Heritage Laboratories West Hartford, CT
I have looked at the help for data.matrix. But didn't find a solution. data.matrix only gets two arguments the data and a logical rownames.force - I have tried to change this logical to TRUE but that doesn't help. Any advice would be greatly appreciated. Thanks!! Liat wrote:> > Hi all, > I'm trying to use heat.map to display some data. > The data is originally in csv format and when I read it in R using > read.table I get: > a b c d e > 1 A 1 1 1 1 > 2 B 1 0 1 1 > 3 C 0 1 0 1 > 4 D 1 1 1 0 > 5 E 1 0 0 0 > The problem is, that for heatmap I need a numerical matrix. When using > data.matrix I get: > a b c d e > [1,] 1 1 1 1 1 > [2,] 2 1 0 1 1 > [3,] 3 0 1 0 1 > [4,] 4 1 1 1 0 > [5,] 5 1 0 0 0 > So I get numerical... but I loss the row names. I would like to see these > names as the y axis labels. > What is the correct/easiest way of achieving this? > Many thanks!!! >-- View this message in context: http://n4.nabble.com/heatmap-image-from-csv-data-tp956968p957059.html Sent from the R help mailing list archive at Nabble.com.
This worked :o) Thanks very much! Liat wrote:> > Hi all, > I'm trying to use heat.map to display some data. > The data is originally in csv format and when I read it in R using > read.table I get: > a b c d e > 1 A 1 1 1 1 > 2 B 1 0 1 1 > 3 C 0 1 0 1 > 4 D 1 1 1 0 > 5 E 1 0 0 0 > The problem is, that for heatmap I need a numerical matrix. When using > data.matrix I get: > a b c d e > [1,] 1 1 1 1 1 > [2,] 2 1 0 1 1 > [3,] 3 0 1 0 1 > [4,] 4 1 1 1 0 > [5,] 5 1 0 0 0 > So I get numerical... but I loss the row names. I would like to see these > names as the y axis labels. > What is the correct/easiest way of achieving this? > Many thanks!!! >-- View this message in context: http://n4.nabble.com/heatmap-image-from-csv-data-tp956968p957118.html Sent from the R help mailing list archive at Nabble.com.