-3

I have 110 tibbles in my environement. These tibbles are among other objects, but all tibbles have a common pattern. I know how to list them with ls(pattern = MyPattern). Now i need to do some basic work on each tibble. I have no idea at all how to handle this, as I will in fact work with a list of charcaters, not tibbles. I tried to assign these tibbles in a new env, but wasn't successful when reading them. I got lots of errors.

Anyone with a solution to apply some work to my selected tibbles?

Konrad Rudolph
  • 482,603
  • 120
  • 884
  • 1,141
gabx
  • 482
  • 2
  • 6
  • 16
  • 1
    Yeah, don’t do that. Where do these 110 tibbles even come from? Have them in a list instead of your global environment. – Konrad Rudolph Aug 30 '17 at 09:41
  • @KonradRudolph they come from a csv with many steps to finally get these tibbles. Yes I want them to be stored in some kind of clean container. – gabx Aug 30 '17 at 10:09
  • See [this post](https://stackoverflow.com/questions/17499013/how-do-i-make-a-list-of-data-frames) on putting data.frames into lists. My answer there returns a named list, which can be nice for referencing if the names of your tibbles have some meaning. – lmo Aug 30 '17 at 11:49

1 Answers1

1

You can use get and mget to access things by name. So this, for example, should work:

lapply(mget(ls(, pattern=MyPattern)), nrow)
Christoph Wolk
  • 1,688
  • 1
  • 5
  • 12