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 -- View this message in context: http://www.nabble.com/Plot-data-from-table-with-column-and-row-names-tp23632750p23632750.html Sent from the R help mailing list archive at Nabble.com.
Gabor Grothendieck
2009-May-20 13:02 UTC
[R] Plot data from table with column and row names
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:> > 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 > > -- > View this message in context: http://www.nabble.com/Plot-data-from-table-with-column-and-row-names-tp23632750p23632750.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. >