[R] goofy class question
Erin Hodgess
erinm.hodgess at gmail.com
Wed Oct 12 09:46:55 CEST 2011
Dear R People:
Here is a really goofy question.
I have some objects which have 2 classes: data.frame and ucr.
Also, the classes will always be in that order.
I have tried all sorts of things, but to no avail.
listucrModels <- function(envir=.GlobalEnv, ...) {
objects <- ls(envir=envir, ...)
if (length(objects) == 0) NULL
else objects[sapply(objects,
function(.x) "ucr"==
(class(eval(parse(text=.x), envir=envir))[2]))]
}
> listucrModels()
[1] NA NA NA NA NA NA NA NA
[9] NA NA NA NA NA "jan.df" NA NA
[17] NA NA NA NA NA NA NA NA
[25] NA NA NA NA NA NA NA NA
>
Since most of them do not have the second class attribute.
How do I get rid of the NA's and just get a list, please?
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
More information about the R-help
mailing list