[R] Help reshaping a dataset with multiple tuples per row

Jim Underwood droolinggeezer at gmail.com
Tue Feb 19 23:29:15 CET 2013


I have a dataset which contains several multi-column measurement sets per row. 
Col 1 identifies patient:

Col1        Col2            Col3          Col 4    Col 5             Col 6       Col7   ...
Patient   Treatment  Outcome  Advice  Treatment  Outcome  Advice
"P1"         "T1"              "O1"          "A1"        "T2"            "O2"          "A2"

Please advise a reshape strategy to generate an output frame with a single measurement per row, e.g.,

Col1        Col2          Col3        Col4
Patient  Treatment Outcome Advice
"P1"         "T1"              "O1"          "A1" 
"P1"         "T2"              "O2"          "A2"


More information about the R-help mailing list