On 3/27/07, Henning Meyer <[EMAIL PROTECTED]> wrote: > Hello, > > I'm new to R but wan't to use it to compute the statistics of my medical > study. > The study includes several parameters for a number of patients. Each > parameter was assessed by a number of readers, once with a special > condition, once without. > Now I have a data.frame with colums like: > > PatientID, ReaderID, SpecialCond(yes/no), Parameter1, Parameter2..... > > the rows are not sorted, and the table is not complete (e.g. some > readers didn't read all cases under all conditions). > > What I would like to do now is for example compute Cohen's Kappa > (ckappa from package(psy)) for Parameter1 under special condition > against no special condition. > Therefore I need a table with colums: > Parameter1WithSpecial, Parameter1WithoutSpecial > And the data should be matched by PatID and ReaderID. How do I get > this kind of table? > > Also how would I compute Kappa for Reader1 against Reader2?
Have a look at the reshape package, http://had.co.nz/reshape. If your data.frame is called df, then code something like the following should get the data in the form that you want dfm <- melt(df, id=c("ReaderID", "PatientID", "SpecialCond")) cast(dfm, ... ~ variable + SpecialCond) Regards, Hadley ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
