Re: [R] Long to wide format without time variable

2009-06-23 Thread Rolf Turner
On 24/06/2009, at 9:52 AM, Alan Cohen wrote: Hi all, I am trying to convert a data set of physician death codings (each individual's cause of death is coded by multiple physicians) from long to wide format, but the "reshape" function doesn't seem to work because it requires a "time" vari

Re: [R] Long to wide format without time variable

2009-06-23 Thread jim holtman
This should do it: > x id COD MDid 1 1 A011 2 2 A022 3 3 A033 4 4 A044 5 5 A055 6 1 B016 7 2 A023 8 3 B035 9 4 B047 10 5 A052 > # max number of columns > maxCol <- max(table(x$id)) > # now create the output > y <- lapply(split(x, x$id),

[R] Long to wide format without time variable

2009-06-23 Thread Alan Cohen
Hi all, I am trying to convert a data set of physician death codings (each individual's cause of death is coded by multiple physicians) from long to wide format, but the "reshape" function doesn't seem to work because it requires a "time" variable to identify the sequence among the repeated obs