Looking to concatenate a column of strings (separated by a ",") when grouped by another column. Example of raw data:
Column1 Column2
1 a
1 b
1 c
1 d
2 e
2 f
2 g
2 h
3 i
3 j
3 k
3 l
Results Needed:
Column1 Grouped_Value
1 "a,b,c,d"
2 "e,f,g,h"
3 "i,j,k,l"
I've tried using dplyr, but I seem to be getting the below as a result
Column1 Grouped_Value
1 "a,b,c,d,e,f,g,h,i,j,k,l"
2 "a,b,c,d,e,f,g,h,i,j,k,l"
3 "a,b,c,d,e,f,g,h,i,j,k,l"
summ_data <-
df_columns %>%
group_by(df_columns$Column1) %>%
summarise(Grouped_Value = paste(df_columns$Column2, collapse =","))