Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I list only the data frame objects in R? [duplicate]

Is there a way to list objects based on their classes ? For example, list only the dataframe objects in the workspace.

like image 643
Veera Avatar asked Nov 08 '25 12:11

Veera


1 Answers

Here is a way with sapply and class to retrieve the names of the objects in the environment that are data.frames:

ls()[sapply(ls(), function(i) class(get(i))) == "data.frame"]
like image 200
lmo Avatar answered Nov 10 '25 08:11

lmo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!