get functions in the environment by their class. Useful to find e.g. all regression models you've stored in interactive programming.
Usage
ls_by_class(classes, envir = parent.frame(), top_class_only = FALSE, ...)
Arguments
- classes
objects should have one of these classes
- envir
defaults to looking in the calling environment of this function, passed to ls
- top_class_only
defaults to FALSE. If false, also returns objects inheriting from one of the specified classes.
- ...
passed to ls
Examples
data(ChickWeight)
chickweight.m1 <- glm(weight ~ Time + Diet, family = gaussian, data = ChickWeight)
ls_by_class('lm')
#> NULL
c('chickweight.m1') %in% ls_by_class('lm')
#> [1] FALSE
c('chickweight.m1') %in% ls_by_class('lm', top_class_only = TRUE)
#> [1] FALSE