[R] Newbie question: How to use tapply() on several vectors simultaneously

2008-08-01 Thread Bertolt Meyer
Dear R users, I have a newbie-question that I couldn't resolve after reading through several pieces of documentation and searching the archive. I have a data.frame containing experimental data from a group experiment in psychology. Each line represents a single participant, but participants

Re: [R] Newbie question: How to use tapply() on several vectors simultaneously

2008-08-01 Thread David Hajage
something like that should work : aggregate(test, list(test[,1]), mean) 2008/8/1 Bertolt Meyer [EMAIL PROTECTED] Dear R users, I have a newbie-question that I couldn't resolve after reading through several pieces of documentation and searching the archive. I have a data.frame containing

Re: [R] Newbie question: How to use tapply() on several vectors simultaneously

2008-08-01 Thread Stephan Kolassa
Hi Bertolt, by(test,INDICES=test$groupID,FUN=mean) And today's a holiday in Switzerland, so stop working already ;-) HTH Stephan Bertolt Meyer schrieb: Dear R users, I have a newbie-question that I couldn't resolve after reading through several pieces of documentation and searching the

Re: [R] Newbie question: How to use tapply() on several vectors simultaneously

2008-08-01 Thread Dimitris Rizopoulos
one option is aggregate(), e.g., test - as.data.frame(cbind(c(rep(1,5),rep(2,5)), rnorm(10), rnorm(10))) names(test)[1] - groupID aggregate(test[c(V2, V3)], list(test$groupID), mean) I hope it helps. Best, Dimitris -- Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic