This can be done using group by operations. We group by the common columns and paste the elements in the column of interest. In the example, it is "X". Group by summarise can be done using data.table, dplyr, aggregate (from base R) etc.
With data.table, we convert the 'data.frame' to 'data.table' (setDT(df1)), grouped by multiple columns (here I used names to specify multiple columns), and paste the "X" column elements.
library(data.table)
setDT(df1)[, list(X= toString(X)), c(names(df1)[c(1:7,9)])]
Or using the same method with dplyr.
library(dplyr)
df1 %>%
group_by_(.dots= names(df1)[c(1:7,9)]) %>%
summarise(X= toString(X))