Re: [R] [FORGED] Grouping Question

2020-03-22 Thread peter dalgaard
Or even split -> lapply -> unsplit, in cases where you want the results put back in the original order. (Doesn't matter here, but it would, had it been, say, ordered 1,2,3,1,2,2,3). -pd > On 22 Mar 2020, at 08:44 , Deepayan Sarkar wrote: > > Another possible approach is to use split ->

Re: [R] [FORGED] Grouping Question

2020-03-22 Thread Rolf Turner
On 22/03/20 8:44 pm, Deepayan Sarkar wrote: Another possible approach is to use split -> lapply -> rbind, which I often find to be conceptually simpler: d <- data.frame(Serial = c(1, 1, 2, 2, 2, 3, 3), Measurement = c(17, 16, 12, 8, 10, 19, 13)) dlist <- split(d, d$Serial)

Re: [R] [FORGED] Grouping Question

2020-03-22 Thread Deepayan Sarkar
Another possible approach is to use split -> lapply -> rbind, which I often find to be conceptually simpler: d <- data.frame(Serial = c(1, 1, 2, 2, 2, 3, 3), Measurement = c(17, 16, 12, 8, 10, 19, 13)) dlist <- split(d, d$Serial) dlist <- lapply(dlist, within, { Serial_test

Re: [R] [FORGED] Grouping Question

2020-03-22 Thread Rolf Turner
On 22/03/20 4:01 pm, Thomas Subia via R-help wrote: Colleagues, Here is my dataset. Serial Measurement Meas_test Serial_test 1 17 failfail 1 16 passfail 2 12 passpass 2 8