I have a dataframe such as :
VALUE Names
1 Sp1,Sp2
1 Sp2
2 Sp3,Sp4
4 Sp2,Sp1
And I would like to count for each df$Names in coma separated way, the sum of df$VALUE and get a new dataframe such as :
Name Sum
Sp1 5
Sp2 6
Sp3 2
Sp4 2
Here is the dataframe in dput format if it can helps:
structure(list(VALUE = c(1L, 1L, 2L, 4L), Names = c("Sp1,Sp2",
"Sp2", "Sp3,Sp4", "Sp2,Sp1")), class = "data.frame", row.names = c(NA,
-4L))