我有以下数据 -
df = data.frame(a=rnorm(10), b=rnorm(10), c=rnorm(10), d=rnorm(10), e=rnorm(10), f=rnorm(10), g=rnorm(10), h=rnorm(10),
i=rnorm(10), j=rnorm(10), u=rnorm(10), v=rnorm(10), w=rnorm(10))
list1 <- data.frame(x = c("a", "b", "c"), y = "u")
list2 <- data.frame(x = c("e", "f", "g", "h"), y = "v")
list3 <- data.frame(x = c("i", "j"), y = "w")
the_list <- list(list1, list2, list3)
我想要的是以下 -
mod_u <- lm(u ~ a + b + c, data = df[,c("a","b","c","u")])
out_u <- tidy(mod_u)
mod_v <- lm(v ~ e + f + g + h, data = df[,c("e","f","g","h","v")])
out_v <- tidy(mod_v)
mod_w <- lm(w ~ i + j, data = df[,c("i","j","w")])
out_w <- tidy(mod_w)
请让我知道一种合适的方法来做到这一点,因为我被卡住并且完全需要这种方式的输出。我还需要对输出(out1、out2、out3)做很多事情,但我一开始就卡住了。提前致谢!