[R] getting list of data.frame names

Erin Hodgess erinm.hodgess at gmail.com
Sun Oct 2 05:37:37 CEST 2011


Dear R People:

This is probably a very simple question.  I know that if I want to get
a list of the classes of the objects in the workspace, I can do this:

> sapply(ls(), function(x)class(get(x)))
           a        a1.df            b            d
      "list" "data.frame"    "integer"    "numeric"

Now I want to get just the data frames.
> sapply(ls(), function(x)class(get(x))=="data.frame")
    a a1.df     b     d
FALSE  TRUE FALSE FALSE

However, I would like the names of the data frames, rather than the
True/False for the objects.

I've been trying all sorts of combinations/permutations with no success.

Any suggestions would be much appreciated.

Thanks,
Sincerely,
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