[R] find the data frames in list of objects and make a list of them
Richard M. Heiberger
rmh at temple.edu
Wed Aug 13 21:12:27 CEST 2014
I would do something like this
lsDataFrame <- function(xx=ls()) xx[sapply(xx, function(x)
is.data.frame(get(x)))]
ls("package:datasets")
lsDataFrame(ls("package:datasets"))
On Wed, Aug 13, 2014 at 2:56 PM, Matthew
<mccormack at molbio.mgh.harvard.edu> wrote:
> Hi everyone,
>
> I would like the find which objects are data frames in all the objects I
> have created ( in other words in what you get when you type: ls() ), then I
> would like to make a list of these data frames.
>
> Explained in other words; after typing ls(), you get the names of objects.
> Which objects are data frames ? How to then make a list of these data
> frames.
>
> A second question: is this the best way to make a list of data frames
> without having to manually type c(dataframe1, dataframe2, ...) ?
>
> Matthew
>
> ______________________________________________
> 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.
More information about the R-help
mailing list