[R] Data manipulation help

Andrew Perrin clists at perrin.socsci.unc.edu
Tue Apr 29 22:30:29 CEST 2003


I have a data frame that contains two ratings on several variables for
each case. My objective at the moment is to calculate a Cohen's Kappa
score for each of these variables between the two raters. Jim Lemon has
kindly provided me with kappa.nom() to do the calculation, but I'm having
trouble getting the data into the right format.

Consider the variable "conv".  It's now stored in a data frame such that
letters.df$first.conv contains the first coder's evaluation for conv, and
letters.df$second.conv contains the second coder's evaluation for conv.
The levels for all these factors are c(-1,0,1). kappa.nom() requires a
frequency table, such that for each case we have:

      -1    0      1
       2    0      0

That is, the count of ratings of -1 (in this case, both coders assigned
-1), the count of 0, and the count of 1.  Is there a relatively easy way
to do this?

Many thanks.

----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists at perrin.socsci.unc.edu * andrew_perrin (at) unc.edu



More information about the R-help mailing list