I would like to calculate the RMS of A and B from the following dataset in R:
Var Diff
A -360
A 361
A -362
B -500
B -647
B 700
I have found a great post about calculating the mean of a subset using the aggregate function here: R: Calculate means for subset of a group.
Is there a way to use the aggregate function to calculate the RMS of a subset? If not, then any other approach would be appreciated. Thanks.