  Dear R users:

  I would like to assign sequence numbers based on group of value but
cannot find an easy way.
Here is a simple instance:

> id = c('a','a','a','b','c','c')
> id
[1] "a" "a" "a" "b" "c" "c"

I hope to create a corresponding vector as --

[1]  1   2   3   1   1   2

That is, in group "a"  the number begins with 1 and then continues to plus 1
until
it happens to the next group.  For "b" It goes back to 1.  Because there is
only one
b, it begins to be 1 again for the first c following, etc.  Could someone
advise me
how to do this in programming rather than manually?  Thanks a lot.

 Tony C.

	[[alternative HTML version deleted]]

