[R] Summarization

Pete B Peter.Brecknock at bp.com
Thu Apr 15 04:11:49 CEST 2010


Hi All

I have a vector x containing 2 levels

x = c(1,1,1,0,0,0,0,1,1,0,0,0,1,1,0)

I would like to derive the following summarization

Level Count
1 3
0 4
1 2
0 3
1 2
0 1

I have generated an inelegant solution using lags and loops but feel sure
that there must be a better approach. If anyone has any thoughts I would be
very grateful if you would share them.

Thanks and best regards

Pete
-- 
View this message in context: http://n4.nabble.com/Summarization-tp1840718p1840718.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list