Given a dataframe (my_data) in R such as the following
category Keyword1 Keyword2 Keyword3 Keyword4 Keyword5 Keyword6 Keyword7 Keyword8
123 0 1 1 0 0 0 0 1
155 1 0 0 0 1 0 1 1
144 0 0 1 0 0 0 1 1
123 1 1 0 0 0 0 1 1
I want to transform the dataframe by taking rows with category id values that already exist (e.g category 123) and combine them. The result should look like:
category Keyword1 Keyword2 Keyword3 Keyword4 Keyword5 Keyword6 Keyword7 Keyword8
123 1 1 1 0 0 0 0 1
155 1 0 0 0 1 0 1 1
144 0 0 1 0 0 0 1 1
How can I do this in R ?