mardi 28 janvier 2020

count conditional occurrences of specific strings and relatively make a new data frame using R

I have a big data frame with 4 columns and many rows (an example is attached). What I want to do is basically for each i in the Family column count the number of occurrences of '5prime', '3prime' or 'CoMature' in the Arm column. And then for the most frequent one ('5prime','3prime' or 'CoMature') take the third and fourth column. To sum up, I need to have a final file that shows the most frequent arm (in the first row) for each i in the Family column and their relative sequences in third and fourth columns.

enter image description here

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire