I'm grouping a dataframe and want to concatenate unique strings.
data= data.frame(
aa=c(1,2,3,4,5,6,7,8,9,10),
bb=c('a','a','a','a','a','b','b','b','b','b'),
cc=c('hello','hello','hi','message','bye','q','w','r','r','t'))
Desired output:
bb cc
a 'hello hi message bye'
b 'q w r t'
Currently I'm doing this(suggested here):
result<- data %>%
group_by(bb) %>%
mutate(body = paste0(cc, collapse = "")) %>%
summarise(t_body = first(body)
But I get all the strings not the unique ones.