I have a dataset where I want to select only one row for each individual each year - however, I would like to mutate a column so that if it says 'yes' for any of that persons rows then all the rows say 'yes'.
This is an example of the dataset I have:
So where the name, clinic and year are the same, I want the tested column to say 'yes' if any of the other rows for that grouping say 'yes'.
Therefore, this is what I would want the dataset to finally look like:


This is quite straightforward using
dplyr. Here is an option:Created on 2024-02-25 with reprex v2.1.0
I would recommend to read this question before posting future questions. It makes easier to help you.