How to use a sub-column in grouped data as a mutating-argument: Suppose I have the following grouped dataframe: