Hi Richard,

    Thank you very much for your reply and your code.
Your code is doing just what I asked for, but does not seem to be what I need.

I will need to review some basic R before I can continue.

I am trying to list data frames in order to bind them into 1 single data frame with something like: dplyr::rbind_all(list of data frames), but when I try dplyr::rbind_all(lsDataFrame(ls())), I get the error: object at index 1 not a data.frame. So, I am going to have to learn some more about lists in R before proceding.

Thank you for your help and code.

Matthew





Matthew

On 8/13/2014 3:12 PM, Richard M. Heiberger wrote:
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
<mccorm...@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@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.

______________________________________________
R-help@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.

Reply via email to