Skip to content
Prev 316780 / 398506 Next

reshape help

Hi Robert,
how about this?

tmp<-read.table(text="ID   Dx
A    nausea
A    diabetes
A    kidney_failure
A    heart_attack
A    fever
B    fever
B    pneumonia
B    heart_attack
B    nausea
B    cough
C    kidney_failure
C    nausea
C    foot_pain",header=T)

data.frame(cbind(ID=levels(tmp$ID),(table(tmp$ID,tmp$Dx))))

hth.

Am 04.02.2013 09:16, schrieb Robert Strother: