Hi everyone, just one question that took my time so long.
I have a data frame in the code below and would like to keep only unduplicated rows based on column char. However, I do not want to lose the information in the column x and y as I remove duplicates.
L3 <- LETTERS[1:3]
char <- sample(L3, 10, replace = TRUE)
print( data.frame(x = rep(c("w","z","x","g","h"), c(2,2,2,3,1)), y = 1:10, char = char))
Is there any possible way to restructure the data frame while removing duplicates and keeping column information corresponding to duplicate items?
I want to get a data frame as below
char x y
1 A x,g 5,6
2 B w,z,x,g 1,2,3,4,5,6,7,8,9
3 C z,n 3,4
Best,
Amare