data.tables can sometimes have columns that are nested lists. This function will either drop these columns or convert them into character strings.
unlist_dt(dat, drop = FALSE, collapse = ";")data.table
dat <- data.table::data.table(a=1:3,b=list(1:2,3:4))
#> Warning: Item 2 has 2 rows but longest item has 3; recycled with remainder.
unlist_dt(dat)
#> Unlisting 2 data.table columns.
#>        I     a      b
#>    <int> <int> <char>
#> 1:     1     1    1;2
#> 2:     2     2    3;4
#> 3:     3     3    1;2