Can I use `rapply` to drill down into a list (the structure of which is unknown; might be nested or might not) to extract some information? For example, I have a list of model objects, one element of which is also a list of model objects. Can I run a function on all at once?

```
df <- data.frame(matrix(rnorm(50), nrow = 10))
names(df) <- c("X","Y1","Y2","Y3","Y4")

modlist <- list(
  m1 = lm(Y1 ~ X, data = df),
  m2 = lm(Y2 ~ X, data = df),
  m3 = list(
    m3.1 = lm(Y3 ~ X, data = df),
    m3.2 = lm(Y4 ~ X, data = df)
  )
)

```

extract the intercept from each relationship:

```
getcoef <- function(x) coefficients(x)[1]

getcoef(modlist[[1]])
# works fine

rapply(modlist, getcoef, classes = "lm", how = "replace")
# returns unlisted model objects!???

```