[R] Best way to organize this data for plotting

Andre Nathan andre at digirati.com.br
Thu Feb 17 14:16:03 CET 2011


Hello

I have a number of data files which are outputs for each step of a
simulation. The data is organized like this:

dmin    dmax           coef
   5       6       0.490981
   3       8       0.098056
   5       6       0.425926
   6       6       0.517860
   2       4       0.527778

I would like to make a 3-d plot where one axis corresponds to (dmin,
dmax) pair, one axis is the simulation step and the other is the mean of
the "coef" column values that share the same (dmin, dmax).

What's the easiest way to do this? I guess my question could be
simplified to: what's the easiest way to get a list like

  (dmin1, dmax1) -> mean(coef such that (dmin, dmax) = (dmin1, dmax1))
  (dmin2, dmax2) -> mean(coef such that (dmin, dmax) = (dmin2, dmax2))
  ...
  (dminN, dmaxN) -> mean(coef such that (dmin, dmax) = (dminN, dmaxN))

given a file like the one above?

Thanks,
Andre



More information about the R-help mailing list