[R] Boxplot position on X-axis relative to it's value

Mächler Marc Jaques marcm at student.ethz.ch
Wed May 12 15:30:48 CEST 2010


Dear R-Experts.

I collected different datas about Nitrogen content (mg/ml) in Dung. The dung was eighter fresh (day=0) or had different ages (15,29,47) to observe nutrient changes over time.

Now I like to draw a boxplot.

boxplot(nmgml~day)
abline((nmgml~day)

The Problem is, that the boxplot considers the day values as groups and not as time series (neighter when the days are numeric or factors).

The result is, that the regression line looks different as when I draw a  plot
plot(nmgml~day)
abline(nmgml~day)

How can I reach that the boxplot's position on the x-axis is relative to the time value? (and the days are not just treated as groups)

Data sample (Girafe-Dung)
   day   nmgml
1   29 2.72655
2   29 2.48820
3   15 2.85945
4   15 2.58915
5   15 2.88345
6   15 2.66675
7   47 3.29125
8   15 2.44085
9   29 2.43065
10  29 2.43425
11  29 2.42705
12   0 1.12350
13  15 5.10310
14  15 0.99880
15   0 2.22350
16  47 2.18290
17  47 2.21570
18  47 2.46450
19  29 2.53350
20  47 2.78550
21  47 3.06920
22   0 2.65660
23   0 2.16650
24   0 2.20620
25   0 1.91870
26   0 2.45160
27   0 2.35980
28   0 1.99900
29   0 2.16300
30  15 2.00460
31  15 2.56220
32  47 2.38650
33  29 2.65820
34  29 2.47670
35  47 2.23770
36  29 2.40080
37  47 2.12650
38  29 2.35950

I really apreciate your help

Sincerly...

MJMaechler (Zurich, Switzerland)


More information about the R-help mailing list