Hi I have used merge() to merge two data frames, very much like performing a SQL join. Now I want to do a few different SQL-style things and I wondered if there were functions to do it...
Is there a "group by" style function? For example if I merge() two data frames and end up with multiple rows for each "id", and want to take the average of the values of a particular column? I know I can probably put something together using merge() and by() and then munging the results together myself, but is there something in R to perform this automatically? The second thing I'd like to do is like a cross-tab query; that is when after a merge() I end up with multiple rows for a particular "id", and want to cross-tab the data so that the multiple values become columns and I end up with one row for each "id" again e.g. ID Val 1 5 1 10 2 15 2 20 Becomes ID Val1 Val2 1 5 10 2 15 20 Thanks in advance! Mick ______________________________________________ [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