Skip to content
Prev 178299 / 398506 Next

Extracting an object name?

On Sat, Apr 25, 2009 at 6:56 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
A variation of this would be:

studentvars <- new.env()
L <- as.list(studentvars)[eapply(e, class) == "lm"]

if (length(L) != 1) cat("warning: there are", length(L), "objects --
should be 1\n")
else  model <- L[[1]]


which would give you the first object of class "lm" so any non-lm
objects won't erroneously be retrieved.  The onl