Hello all - I have an example column in a dataFrame
id.name 123.45 123.45 123.45 123.45 234.56 234.56 234.56 234.56 234.56 234.56 234.56 345.67 345.67 345.67 456.78 456.78 456.78 456.78 456.78 456.78 456.78 456.78 456.78 ... [truncated] And I'd like to create a second vector of sequential values (i.e., 1:N) for each unique id.name value. In other words, I need id.name x 123.45 1 123.45 2 123.45 3 123.45 4 234.56 1 234.56 2 234.56 3 234.56 4 234.56 5 234.56 6 234.56 7 345.67 1 345.67 2 345.67 3 456.78 1 456.78 2 456.78 3 456.78 4 456.78 5 456.78 6 456.78 7 456.78 8 456.78 9 The number of unique id.name values is different; for some values, nrow() may be 42 and for others it may be 36, etc. The only way I could think of to do this is with two nested for loops. I tried it but because this data set is so large (nrow = 112,679 with 2,161 unique values of id.name), it took several hours to run. Is there an easier way to create this vector? I'd appreciate your thoughts. Thanks - SR Steven H. Ranney [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.