ls_by_class: get functions in the environment by their class. Useful to...

View source: R/shorthands.R

ls_by_classR Documentation

get functions in the environment by their class. Useful to find e.g. all regression models you've stored in interactive programming.

Description

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')
c('chickweight.m1') %in% ls_by_class('lm')
c('chickweight.m1') %in% ls_by_class('lm', top_class_only = TRUE)


rubenarslan/formr documentation built on July 6, 2024, 5:46 a.m.