I have data with two dimensions (2 treatments x 3 days), and the goal is to draw the line graph presenting the means and error bars with 2 lines. However, when I use "plot" to draw the means, the result is the graph with 3 X 3 square (don't know what it is ).
data:
no. ,Treatment, D1, D2, D3
1, A , 4 , 5 , 5
2, A , 6 , 6 , 4
3, A , 5 , 7 , 8
4, B , 2 , 1 , 3
5, B , 3 , 2 , 2
6, B , 3 , 2 , 3
I used aggregate
to compute the means and standard error. However, when I use plot
, the result is weird.
dta=read.table(file ='dta.csv', header = T, sep = ',')
dta.mean=aggregate(dta[,-1:-2], list(dta$Treatment),mean)
plot(dta.mean[1,2:4])
I expected the line graph consisting of 2 lines (one is treatment A, the other is treatment B), and the y values are the means with error bars. Please help me :( Thanks a lot!
image1: this is the wrong result
image2: the expected one