Levels | R Documentation |
Useful as an argument to lapply
Levels(x, na.rm = TRUE)
x |
vector |
na.rm |
(default TRUE) remove NAs if x is not a factor, otherwise just return levels(x) |
## Not run:
head(hs)
fits <- lapply(Levels(hs$school), function(sid)
lm(mathach ~ ses, subset(hs, school == sid)))
coefs <- lapply(fits, coefs)
df <- do.call(rbind, coefs)
df$school <- names(df)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.