> library(plyr)
> # Function to sum y by A-B combinations for a generic data frame
> dsum <- function(d) ddply(d, .(A, B), summarise, sumY = sum(y))
See count in plyr 1.4 for a much much faster way of doing this.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statist
Hi:
Try this based on the following toy example:
### Generate a list of named data frames
# There are more efficient ways to do this with replicate, but I forgot :)
# A function to generate a data frame
dmake <- function() data.frame(A = factor(rep(1:5, each = 10)),
Dear all,
I have 9 data frames, and I'm simply trying to sum the values of column 3 (on a
row-by-row basis). However, there are a slightly different number of rows in
each data frame, so I'm receiving the following error: "Error in
Ops.data.frame(mrunoff_207101[3], mrunoff_207102[3]) :
+ on
3 matches
Mail list logo