Skip to content
Prev 323136 / 398502 Next

create unique ID for each group

You can make a new within-group sequence number with ave():
ObsNumber     ID          Weight
     1                 0001         12
     2                 0001          13
     3                 0001           14
     4                  0002         16
      5                 0002         17
     6                   N/A          18   
",sep="",header=TRUE,colClass=c("numeric","character","numeric"),na.strings="N/A")
[1]  1  2  3  1  2 NA

Use merge() with the 'by' columns being ID and withinIDSeq or paste them together
yourself and use the result as your single 'by' column.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com