更新时间:2023-12-02 19:41:46
您可以这样做:
foo <- function(List, what, time = 1){
s <- substitute(what)
s <- bquote(.(s) & weeks == time)
h <- lapply(List, function(x) do.call("subset", list(x, s)))
h1 <- Filter(NROW, h)
h2 <- lapply(List[names(h1)], function(x) subset(x, control))
Map(rbind, h1, h2)
}
# AND THEN:
lapply(1:3, function(i) foo(L, type == 1, time = i))