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]) :
+ only defined for equally-sized data frames".
Here is what I'm attempting to do:
> arunoff_2071 <- cbind(mrunoff_207101[1:2], (mrunoff_207101[3] +
> mrunoff_207102[3] + mrunoff_207103[3] + mrunoff_207104[3] + mrunoff_207105[3]
> + mrunoff_207106[3] + mrunoff_207107[3] + mrunoff_207108[3] +
> mrunoff_207109[3]))
Is there an easy way of summing based on congruent values in columns 1 and 2?
The only way I can think of would be to use merge, but this would involve doing
this for every pair of data frames.
The data for each data frame look like this:
> head(mrunoff_207101)
Latitude Longitude FPC
1 5.75 0.25 0.0112384744
2 6.25 0.25 0.0019959067
3 6.75 0.25 0.0003245941
4 7.25 0.25 0.0011973676
5 7.75 0.25 0.0001062602
6 8.25 0.25 0.0451578423
Any suggestions on how to achieve this easily will be very welcome.
Many thanks,
Steve
______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.