0

I have a dafarame such as :

Names  COLA COLB COLC
sp1_A  1    0    1   
sp1_A  1    0    0 
sp1_B  0    1    1          
sp2_A  0    0    1   
sp2_A  0    1    1     
sp2_A  0    0    1

And I would like for each Names to sum the row content and get

I shoudl then get:

Names  COLA COLB COLC
sp1_A  2    0    1   
sp1_B  0    1    1             
sp2_A  0    1    3

Here is the dput format of the dataframe :

structure(list(Names = c("sp1_A", "sp1_A", "sp1_B", "sp2_A", 
"sp2_A", "sp2_A"), COLA = c(1L, 1L, 0L, 0L, 0L, 0L), COLB = c(0L, 
0L, 1L, 0L, 1L, 0L), COLC = c(1, 0, 1, 1, 1, 1)), class = "data.frame", row.names = c(NA, 
-6L))
chippycentra
  • 3,396
  • 1
  • 6
  • 24

0 Answers0