A similar questions was asked a few years ago here.
My setting is a little different. My indicator variables are not \"true\" dummy variables because they overlap. <
Here's one way using tidyverse functions
library(tibble)
library(dplyr)
library(tidyr)
dat %>%
rowid_to_column() %>% # keep data for each row together
gather("col", "val", -rowid) %>%
mutate(rowid=factor(rowid)) %>%
filter(val==1) %>%
group_by(rowid) %>%
summarize(desired=paste(col, collapse=",")) %>% #collapse values
complete(rowid, fill = list(desired="none")) # add "none" for empty groups
# rowid desired
# <fct> <chr>
# 1 1 none
# 2 2 a
# 3 3 a,b,c
The basic idea involves reshaping the data so we can run functions of groups rather than running functions over rows of a data.frame which isn't as easy.