John Christie
2004-Apr-19 12:41 UTC
[R] looking for something like "ave" I can pass non numeric to
Hi, I have been trying to calculate summary error and coding statistics on a by subject basis and seem to be writing a lot of code to do a simple thing. I won't go into my messy version. What I am asking is if anyone knows of a single command that could take the following data and get error rates over a given vector. Given data from ss with,,, subj a rt code 1 1 200 good 1 1 321 good 1 2 457 good 1 2 384 bad 2 1 228 good 2 1 343 bad .... I would like to do a calculation something like ave returns. An artificial example that does not work where I have passed the code field to ave is below. ss$FAcount<- ave(ss$code, ss$subj, function(x) length(x[x=="good"])/length(x))