My data consist of an identifier (srdr_id), and a list column.
dat <- structure(list(srdr_id = c("174136", "174258", "174684"), outcomes = list(
structure(list(outcome_s = c("use_alcohol", "use_cannabis",
"use_cocaine")), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-3L)), structure(list(outcome_s = "use_methamphetamine"), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -1L)), structure(list(
outcome_s = c("use_alcohol", "use_heavy")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -2L)))), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -3L))
> dat
# A tibble: 3 x 2
srdr_id outcomes
<chr> <list>
1 174136 <tibble [3 x 1]>
2 174258 <tibble [1 x 1]>
3 174684 <tibble [2 x 1]>
I would like to convert each tibble in outcomes to a single comma separated string.