Skip to content
Prev 351075 / 398502 Next

Subset and 0 replace?

On 20/05/2015 7:13 PM, Vin Cheng wrote:
The summaryBy function is not in base R.  There's a function with that
name in the doBy package; is that the one you're using?

You doing say how to do the grouping, and I can't read your code to
figure it out, but this code will do what you want with suitable inputs:

by(df, group, function(subset) with(subset, sum(Wgt[SPCLORatingValue >
16])))

where df is your dataframe, and group is a variable that defines the groups.

Duncan Murdoch