ccsarapas / lighthouse

Utility Functions for Lighthouse Institute Projects
https://ccsarapas.github.io/lighthouse/
Other
0 stars 0 forks source link

consider list-column handling for `in_excel()` #22

Open ccsarapas opened 3 months ago

ccsarapas commented 3 months ago

ie, an arg list_collapse = FALSE. FALSE would provide current behavior of blank cells in the output. TRUE would collapse each list element, e.g.,

df <- df %>%
  mutate(across(
    where(is.list), 
    \(col) map_chr(col, \(x) str_c(x, collapse = "; "))
  ))

Would want to include some kind of check that the list columns can be appropriately handling by str_c() -- eg, not nested lists.

I considered also including an option to unnest list-columns into separate rows, but I this could get messy when there are multiple list-columns in the dataframe, if they don't all have the same number of elements per row.