[R] using tapply with multiple variables

From: Kevin Burnham <kburnham_at_gmail.com>
Date: Sat, 30 Apr 2011 14:28:53 -0500


HI All,

I have a long data file generated from a minimal pair test that I gave to learners of Arabic before and after a phonetic training regime. For each of thirty some subjects there are 800 rows of data, from each of 400 items at pre and posttest. For each item the subject got correct, there is a 'C' in the column 'Correct'. The line:

tapply(ALLDATA$Correct, ALLDATA$Subject, function(x)sum(x=="C"))

gives me the sum of correct answers for each subject.

However, I would like to have that sum separated by Time (pre or post). Is there a simple way to do that?

What if I further wish to separate by Group (T or C)?

Thanks,
Kevin

        [[alternative HTML version deleted]]



R-help_at_r-project.org 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. Received on Sat 30 Apr 2011 - 19:32:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 01 May 2011 - 11:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive