Using list columns in data.table

There's some missing dependencies for your first reprex: magrittr, broom, speedlm ggplot2 and DescTools in the second.

Also the call on the fifth line of the first example should be:

                       ~ glance(speedglm::speedlm(

In the second, same change should me made on line 14, and line 20 should be

dmd_dt[,':='(model = purrr::map(data,

and conforming changes should be made on lines 26, 28 and 35.

You need ggplot2 to load diamonds

library(data.table)
library(broom)
library(DescTools)
library(magrittr)
data(ggplot2::diamonds)

With these corrects, I get to

> summary(rlang::last_error())
<error>
message: Columns `r.squared`, `adj.r.squared`, `statistic`, `p.value`, `df` must be 1d atomic vectors or lists
class:   `rlang_error`
fields:  `message`, `trace` and `parent`
backtrace:
█
├─...[]
└─data.table:::`[.data.table`(...)
  └─base::eval(jsub, SDenv, parent.frame())
    └─base::eval(jsub, SDenv, parent.frame())
      └─purrr::map(...)
        └─global::.f(.x[[i]], ...)
          ├─generics::glance(speedglm::speedglm(carat ~ cut + depth, data = .x))
          └─broom:::glance.speedlm(...)
            └─tibble::tibble(...)
              ├─tibble::as_tibble(lst_quos(xs, expand = TRUE))
              └─tibble:::as_tibble.list(lst_quos(xs, expand = TRUE))
                └─tibble:::list_to_tibble(x, validate)
                  └─tibble:::check_tibble(x)
                    └─tibble:::invalid_df(...)
                      └─tibble:::stopc(...)
> 

It may be possible to substitute library(tidyverse) for the separate calls to purrr, ggplot2 and magrittr, but I still don't think we have a reprex

2 Likes