I want to be able to collapse and sum values dependent on the gene name
You can use dplyr, where df is your data.frame:

df %&gt;% group_by(gene) %&gt;% summarise_if(is.numeric, sum)


This will sum each column separately (assuming it is numeric), grouped by each gene. Any column that is not included in the group_by or is not numeric will be dropped at this stage.