0

I'm working with multiple dataframes, all of them stocked in the global environment. I seek for a way to use a function on all of them, without having to write the function for each one, ie applying a function to all the object of the environment instead of writing one line for each object.

Here's the environment I'm working on:

enter image description here

zx8754
  • 52,746
  • 12
  • 114
  • 209
  • 1
    Something like this: `lapply(mget(ls()), function(i) doStuff(i))` put all dataframes into a list, then apply a function. – zx8754 Feb 18 '21 at 12:01
  • 2
    In addition to zx8754's comment, you may want to filter for objects in the environment that are indeed data frames, using something like `eapply(.GlobalEnv,is.data.frame)`. – Lennart Oelschläger Feb 18 '21 at 12:09

0 Answers0