如何使用 lapply 函数进行 Levene 检验

How can I do the Levene's test using lapply function

如何对回归进行 Levene 检验(汽车包装)?对于我的回归,我使用了 lapply 函数。

这是我的代码

library(data.table)

Regressions<- 
data.table(February)[, 
                  .(Lm = lapply(.SD, function(x) summary(lm(February$PPNA ~ February$Acum1 + x)))),
                  .SDcols = 80:157]

如果我们有一个分组列 ('group'),那么我们循环遍历 .SDcols 中感兴趣的列,应用具有该列值的 levene.test 和组

library(data.table)
library(car)
as.data.table(February)[, 
              .(Lm = lapply(.SD, function(x) list(levene.test(x, group)))),
              .SDcols = 80:157]