Is it possible to use ddply to summarize the data without stratifying by a group? I've tried something like
ddply(df, summarize, a = sum(a, na.rm=T), b = sum(b, na.rm=T))
The function ddply will accept an "empty" grouping variable and perform the analysis on the entire table.
With subgroups:
ddply(baseball, .(lg), c("nrow", "ncol"))
lg nrow ncol
1 65 22
2 AA 171 22
3 AL 10007 22
4 FL 37 22
5 NL 11378 22
6 PL 32 22
7 UA 9 22
Without subgroups:
ddply(baseball, .(), c("nrow", "ncol"))
.id nrow ncol
1 <NA> 21699 22
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With