Skip to content

Plot data from table with column and row names

2 messages · Matt Bishop, Gabor Grothendieck

#
Dear All
Sorry for what appears a trivial matter - I'm new to R and am stumbling
ahead.

I have a table of numerical data (36 rows by 12 columns) such as below:

       GM1  GM2  GM3  GM4  GM5 ...etc GM12
Run1  1      2      1       2      3   ...
Run2  2      1      3       2      1   ...
...
Run36 2      1      1      1      1  

I would like to plot simple line graphs of some of the runs or all 36 to
compare together but I can't even get a plot to have the GM1-GM12 on the
x-axis and the numerical y -axis with the scores (1 to 3).
I think that using >Plot(x) is not correct for this type of data.
Help would be appreciated - I'm sure I'm missing something...
Matt
#
Here are a few possibilities:


Lines <- "GM1  GM2  GM3  GM4  GM5
Run1  1      2      1       2      3
Run2  2      1      3       2      1
Run3 2      1      1      1      1"

DF <- read.table(textConnection(Lines), header = TRUE)
long <- as.data.frame.table(as.matrix(DF))
head(long)

with(long, balloonplot(Var1, Var2, Freq))

library(lattice)
dotplot(Freq ~ Var1, long, group = Var2, type = "l")
On Wed, May 20, 2009 at 6:21 AM, Matt Bishop <m.bishop at ed.ac.uk> wrote: