I have a dataframe that looks like this
Name Cricket Football Swimming A Y Y N B N Y N C Y N
Something like this (in base R) would do it too:
df$Sports <- apply(df[,-1]=="Y", 1, function(r) paste(names(df)[-1][r], collapse=" and ")) # Name Cricket Football Swimming Sports #1 A Y Y N Cricket and Football #2 B N Y N Football #3 C Y N Y Cricket and Swimming