[R] disaggregating table

2006-10-23 Thread Jeff Miller
Hi all, This should be easy, but I can't seem to figure it out. I have a table like this named newtable a1 a2 a3 a4 Cnts Score 1 100 4 3.28 1 011 2 2.63 I want the following: a1 a2 a3 a4 Cnts Score 1 100 4

Re: [R] disaggregating table

2006-10-23 Thread Prof Brian Ripley
On Sun, 22 Oct 2006, Jeff Miller wrote: Hi all, This should be easy, but I can't seem to figure it out. ind - rep(1:nrow(newtable), times=newtable$Cnts) newtable[ind, -5] gives a1 a2 a3 a4 Score 11 1 0 0 3.28 1.1 1 1 0 0 3.28 1.2 1 1 0 0 3.28 1.3 1 1 0 0 3.28 2