I have patient IDs in one column and if a given mutation is clonal or sub clonal like
SampleID Mutation A Clonal A Clonal A Clonal A Subclonal A Subclonal A Subclonal A Clonal A Clonal B Clonal B Clonal B subclonal C subclonal C clonal
Here, sample A has 5 clonal and 3 sub clonal mutations, sample B has 2 clonal and 1 sub-clonal mutations and sample C has 1 clonal and 1 sub clonal mutation
I want to write this like
SampleID Clonal Subclonal A 5 3 B 2 1 C 1 1
Do you know how I can do that in R?