I have some data, where first column have some duplicating rows, thought another column is from all different data. I need to leave just one duplicating row in first column and merge rows with different ones from another column. For example
Z = c( "a", "a", "b", "c", "d", "d", "d")
X = c( 10, 10, 0, 3, 4, 4, 4)
Y = c("ab", "bc", "dv", "mh", "op", "va", "po")
c = data.frame(Z,X,Y)
c
Z X Y
1 a 10 ab
2 a 10 bc
3 b 0 dv
4 c 3 mh
5 d 4 op
6 d 4 va
7 d 4 po
I need to merge
Z X Y
a 10 ab,bc
b 0 dv
c 3 mh
d 4 op, va, po
or even
Z X Y L V
a 10 ab bc
b 0 dv
c 3 mh
d 4 op va po
Is it possible?