Skip to content
Prev 227868 / 398500 Next

Creating Enumerated Variables

On Thu, Jul 15, 2010 at 10:45 AM, jdellava <jdellava at vcu.edu> wrote:
The first statement uses ave to create the sequences and the second
statement sorts it:

xx2 <- transform(xx, Count = ave(ID, Age, School, FUN = seq_along))
xx2[order(xx2$Age, xx$School),]