See if this example helps; show how to either plot the row or columns of a data frame:
> test <- data.frame(C1=runif(10), C2=runif(10), C3=runif(10)) > test C1 C2 C3 1 0.91287592 0.3390729 0.4346595 2 0.29360337 0.8394404 0.7125147 3 0.45906573 0.3466835 0.3999944 4 0.33239467 0.3337749 0.3253522 5 0.65087047 0.4763512 0.7570871 6 0.25801678 0.8921983 0.2026923 7 0.47854525 0.8643395 0.7111212 8 0.76631067 0.3899895 0.1216919 9 0.08424691 0.7773207 0.2454885 10 0.87532133 0.9606180 0.1433044 > # this will plot each column (C1, C2, C3) > matplot(test, type='o') > # plot each row > matplot(t(test), type='o') On Sat, Jul 4, 2009 at 8:02 PM, Mark Knecht<markkne...@gmail.com> wrote: > OK, I guess I'm getting better at the data part of R. I wrote a > program outside of R this morning to dump a bunch of experimental > data. It's a sort of ragged array - about 700 rows and 400 columns, > but the amount of data in each column varies based on the length of > the experiment. The real data ends with a 0 following some non-zero > value. It might be as short as 5 to 10 columns or as many as 390. The > first 9 columns contain some data about when the experiment was run > and a few other things I thought I might be interested in later. All > the data starts in column 10 and has headers saying C1, C2, C3, C4, > etc., up to C390 The first value for every experiment is some value I > will normalize and then the values following are above and below the > original tracing out the path that the experiment took, ending > somewhere to the right but not a fixed number of readings. > > R reads it in fine and it looks good so far. > > Now, what I thought I might do with R is plot all 700 rows as > individual lines, giving them some color based on info in columns 1-9, > but suddenly I'm lost again in plots which I think should be fairly > easy. How would I go about creating a plot for even one line, much > less all of them? I don't have a row with 1,2,3,4 to us as the X axis > values. I could go back and put one in the data but then I don't think > that should really be required, or I could go back and make the > headers for the whole array 1:400 and then plot from 10:400 but I > thought I read that headers cannot start with numbers. > > Maybe the X axis values for a plot can actually be non-numeric C1, C2, > C3, C4, etc and I could use line (C1,0) to (C2,5) and so on? Or maybe > I should strip the C from C1 and be left with 1? Maybe the best thing > is to copy the data for one line to another data.frame or array and > then plot that? > > Just sort of lost looking at help files. Thanks for any ideas you can > send along. Ask questions if I didn't explain my problem well enough. > Not looking for anyone to do my work, just trying to get the concepts > right > > Cheers, > Mark > > ______________________________________________ > R-help@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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ R-help@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.