Re: [R] Add sequence numbers to lines with the same ID: How can this be accomplished?

2015-10-25 Thread Bert Gunter
Yay Chuck! Boo Bert. -- Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Sat, Oct 24, 2015 at 9:05 PM, Charles C. Berry wrote: > On Sat, 24 Oct 2015, Bert Gunter wrote: > >> Rolf's

Re: [R] Add sequence numbers to lines with the same ID: How can this be accomplished?

2015-10-24 Thread Bert Gunter
Rolf's solution works for the situation where all duplicated values are contiguous, which may be what you need. However, I wondered how it could be done if this were not the case. Below is an answer. It is not as efficient or elegant as Rolf's solution for the contiguous case I think; maybe

[R] Add sequence numbers to lines with the same ID: How can this be accomplished?

2015-10-24 Thread John Sorkin
I have a file that has (1) Line numbers, (2) IDs. A given ID number can appear in more than one row. For each row with a repeated ID, I want to add a number that gives the sequence number of the repeated ID number. The R code below demonstrates what I want to have, without any attempt to

Re: [R] Add sequence numbers to lines with the same ID: How can this be accomplished?

2015-10-24 Thread Rolf Turner
On 25/10/15 11:28, John Sorkin wrote: I have a file that has (1) Line numbers, (2) IDs. A given ID number can appear in more than one row. For each row with a repeated ID, I want to add a number that gives the sequence number of the repeated ID number. The R code below demonstrates what I

Re: [R] Add sequence numbers to lines with the same ID: How can this be accomplished?

2015-10-24 Thread Charles C. Berry
On Sat, 24 Oct 2015, Bert Gunter wrote: Rolf's solution works for the situation where all duplicated values are contiguous, which may be what you need. However, I wondered how it could be done if this were not the case. Below is an answer. It is not as efficient or elegant as Rolf's solution

Re: [R] Add sequence numbers to lines with the same ID: How can this be accomplished?

2015-10-24 Thread Rolf Turner
On 25/10/15 12:33, Bert Gunter wrote: Rolf's solution works for the situation where all duplicated values are contiguous, which may be what you need. However, I wondered how it could be done if this were not the case. Below is an answer. It is not as efficient or elegant as Rolf's solution for