Re: [R] ls() and classes

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Wed, 19 Mar 2008 14:50:32 +0000 (UTC)

Rolf Turner <r.turner_at_auckland.ac.nz> wrote in news:72856D72-D960-48ED-AA77-ABD353548C08_at_auckland.ac.nz:

>
> On 19/03/2008, at 4:39 PM, Erin Hodgess wrote:
>

>> Dear R People:
>>
>> I want to get the class of all of the objects in my directory.
>>

>
> Too easy!!!
>
> sapply(ls(),function(x){class(get(x))})
>

Thank you, Rolf. That supplied the needed index to the question I struggled with yesterday: How to get a list of only my dataframes:

ls()[sapply(ls(),function(x){class(get(x))}) == "data.frame"]

-- 
David Winsemius

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 19 Mar 2008 - 15:07:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 19 Mar 2008 - 20:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive