Hi Erin, Try this: names(which(sapply(.GlobalEnv, is.data.frame)))
Cheers, Josh On Sat, Oct 1, 2011 at 8:37 PM, Erin Hodgess <erinm.hodg...@gmail.com> wrote: > 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.hodg...@gmail.com > > ______________________________________________ > 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. > -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ ______________________________________________ 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.