This is the data.frame
with I am working to
I am trying to delete duplicate values from the conflict_id
variable but without losing any information for the variable side_b
. My only idea was to delete it this way.
data2 <- data[!duplicated(data$conflict_id),]
But the result delete all the information of the column side_b
. R takes all the values that are not the same in coflict_id
without grouping the values of side_b
My question is, how can I delete the duplicate values in conflict_id
and group the values of side_b
without losing any information of this variable and grouping it in each conflict_id
result?
At the same time, how can I delete the values of side_b
that are duplicate if they are together. Example, one of the 267conflict_id
is "EPDM, EPRP, TPLF", but there is not separation between then. How can I do this "EPDM"," EPRP"," TPLF" for all the values in the data.frame
?