I am trying to achieve the following, on which I\'m stuck onfortunately.
I have a dataframe containing: