Hi I think I seem to have phrased my doubt incorrectly. I want a x-y plot of age v/s rate (the bin is irrelevant for this plot); only that instead of a simple x-y plot, i want a plot of average(rate) for each age-intervals.
My ages vary from 0 to 0.7 and I want to divide them in groups of 0.02. So I want a plot of the following Age-intervals Average rate in that interval 0-0.02 5 0.02-0.04 7 0.04-0.06 1 0.06-0.08 0 0.08-0.1 0.15 Age-intervals mentioned along the x-axis (like for a histogram) and rates plotted for each age-interval --- Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Or perhaps a bit simpler: > > plot(age ~ ave(clock, bin), DF) > > > On 4/30/06, Gabor Grothendieck > <[EMAIL PROTECTED]> wrote: > > My understanding is that you want to replace each > rate with its average > > over the associated bin and then plot age against > that. In that > > case try this: > > > > > DF # test data > > age rate bin > > 1 0.002 10.0 A > > 2 0.045 0.1 B > > 3 0.130 15.0 A > > 4 0.150 34.0 D > > > with(DF, plot(ave(rate, bin), age)) > > > > Assuming they > > are stored in vectors > > the columns are age, rate, bin we would have > > > > plot(ave(clock, bin), age) > > > > On 4/30/06, lalitha viswanath > <[EMAIL PROTECTED]> wrote: > > > Hi > > > I am trying to get a table of means of parameter > 1 > > > across BINS of parameter 2. > > > > > > I am working in proteomics and a sample of my > data is > > > as follows > > > > > > cluster-age clock-rate(evolutionary rate) > scopclass > > > 0.002 10 A > > > 0.045 0.1 B > > > 0.13 15 A > > > 0.15 34 D > > > .... > > > .... > > > .... > > > .... > > > > > > Scop class has only 9 distinct categories (A-I) > > > Whereas cluster-age and clock-rate are discrete > > > variables greater than 0. > > > > > > I am trying to do two things with this kind of > data, > > > out of which I managed to accomplish one thanks > to the > > > documentation and pre-existing queries on the > mailing > > > lists. > > > 1. Plot a histogram of the age distribution with > scop > > > class category superimposed on each bin. I > managed to > > > do this with barplot2. > > > 2. Now I am trying to plot a scatter plot of the > age > > > v/s the clock-rate. However to eliminate > possible > > > sampling errors, we are trying to get an average > of > > > the clock-rate for each of the bins used above. > > > i.e. before plotting a x-y plot, i wish to > compute > > > average clock-rate in each of the bins for the > age and > > > then plot a x-y plot of the age v/s clock rate. > > > > > > Can anyone point me to appropriate functions for > the > > > same? > > > I am trying to work with prop.table, cut, break, > etc. > > > But I am not heading anywhere. > > > > > > Thanks > > > Lalitha > > > > > > ______________________________________________ > > > R-help@stat.math.ethz.ch mailing list > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > > > > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html