Hi, all. I got a lot of help from the this mailing list, it save me a lot of time. Here is my question. x<-rep(c(2,3,4),20) y<-sample(rep(c(0,1),30)) tr<-rep(c(1:5),6) data1<-data.frame(x,y,tr) data1<-data1[order(data1$tr),]> data1 x y tr1 2 0 16 4 1 111 3 0 116 2 0 121 4 0 126 3 1 131 2 0 136 4 1 141 3 0 146 2 0 151 4 0 156 3 0 12 3 0 27 2 0 212 4 0 2.......table(data1)> table(data1), , tr = 1yx 0 1 2 4 0 3 3 1 4 2 2 , , tr = 2 yx 0 1 2 3 1 3 3 1 4 2 2.... Question: How to get accumulate contingency table by variable "tr" in data1? e.g. how to get the following results. , , tr = 1 yx 0 1 2 4 0 3 3 1 4 2 2 , , tr = 2 yx 0 1 2 7 1 3 6 2 4 4 4... Thank you for your help. xj. _________________________________________________________________ [[elided Hotmail spam]] [[alternative HTML version deleted]]
Hi, all. I got a lot of help from the this mailing list, it save me a lot of time. Here is my question. x<-rep(c(2,3,4),20)y<-sample(rep(c(0,1),30))tr<-rep(c(1:5),6)data1<-data.frame(x,y,tr)data1<-data1[order(data1$tr),]> data1 x y tr1 2 0 16 4 1 111 3 0 116 2 0 121 4 0 126 3 1 131 2 0 136 4 1 141 3 0 146 2 0 151 4 0 156 3 0 12 3 0 27 2 0 212 4 0 2....... table(data1) > table(data1), , tr = 1 yx 0 1 2 4 0 3 3 1 4 2 2, , tr = 2 yx 0 1 2 3 1 3 3 1 4 2 2....Question: How to get accumulate contingency table by variable "tr" in data1? e.g. how to get the following results., , tr = 1 yx 0 1 2 4 0 3 3 1 4 2 2, , tr = 2 yx 0 1 2 7 1 3 6 2 4 4 4... Thank you for your help. xj. Shed those extra pounds with MSN and The Biggest Loser! Learn more. _________________________________________________________________ Climb to the top of the charts! Play the word scramble challenge with star power. [[alternative HTML version deleted]]