I use duplicate results to estimate the measurement uncertainty for chemical analyses. When I extract data from the laboratory database it consists largely of single results but with some samples tested twice, some more than twice (I have seen up to 12). I want to discard all the single analyses and just retain the duplicated results, but including the original result.
The samples are identified by a sample number that is common to the duplicate samples.
I can pull out the duplicates using duplicated() but how to I retain the first result as well?
Thanks.