We can extract the AIC
values and order
based on the 'AIC' values
library(data.table)
dt <- as.data.table(February)
dt1 <- dt[, .(Lm = lapply(.SD, function(x) lm(February$PPNA ~ February$Acum1 + x))),
.SDcols = 80:157]
dt2 <- dt1[, .(Lm = Lm[order(unlist(lapply(Lm, AIC)))])]
Or using a reproducible example
dt1 <- as.data.table(iris)[, .(Lm = lapply(.SD, function(x)
lm(iris$Petal.Length ~ iris$Species + x)))]
dt2 <- dt1[, .(Lm = Lm[order(unlist(lapply(Lm, AIC)))])]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…