[R] tapply and error bars
Ogbos Okike
giftedlife2014 @ending from gm@il@com
Sat Jun 23 08:35:37 CEST 2018
Dear workers,
I have a data of length 1136. Below is the code I use to get the means B.
It worked fine and I had the mean calculated and plotted.
I wish to plot the error bars as well. I already plotted such means with
error bars before. Please see attached for example.
I tried to redo the same plot but unlikely could not get around it as I
lost my system containing the script.
Among many attempts, I tried:
library(gplots)
plotmeans(errors~AB,xlab="Factor A",ylab="mean errors", p=.68, main="Main
effect Plot",barcol="black")
Nothing worked.
I would really be thankful should somebody return me to the track.
Many, many thanks for your time.
Ogbos
A sample of the data is:
S/N A B
1 -5 64833
2 -4 95864
3 -3 82322
4 -2 95591
5 -1 69378
6 0 74281
7 1 103261
8 2 92473
9 3 84344
10 4 127415
11 5 123826
12 6 100029
13 7 76205
14 8 105162
15 9 119533
16 10 106490
17 -5 82322
18 -4 95591
19 -3 69378
20 -2 74281
21 -1 103261
22 0 92473
23 1 84344
24 2 127415
25 3 123826
26 4 100029
27 5 76205
28 6 105162
29 7 119533
30 8 106490
31 9 114771
32 10 55593
33 -5 85694
34 -4 65205
35 -3 80995
36 -2 51723
37 -1 62310
38 0 53401
39 1 65677
40 2 76094
41 3 64035
42 4 68290
43 5 73306
44 6 82176
45 7 75566
46 8 89762
47 9 88063
48 10 94395
49 -5 80651
50 -4 81291
51 -3 63702
52 -2 70297
53 -1 64117
54 0 71219
55 1 57354
56 2 62111
57 3 42252
58 4 35454
59 5 33469
60 6 38899
61 7 64981
62 8 85694
63 9 79452
64 10 85216
65 -5 71219
66 -4 57354
67 -3 62111
68 -2 42252
69 -1 35454
70 0 33469
71 1 38899
72 2 64981
73 3 85694
74 4 79452
75 5 85216
76 6 81721
77 7 91231
78 8 107074
79 9 108103
80 10 7576
A<-matrix(rep(-5:10,71))
B<-matrix(data)
AB<-data.frame(A,B)
x= B
f<-factor(A)
AB<- tapply(x,f,mean)
x<--5:10
plot(x,AB,type="l")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: true.png
Type: image/png
Size: 34158 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180623/67dd79a5/attachment.png>
More information about the R-help
mailing list