0

I have a for cycle which makes new table for every i. How can I name those tables ``table_i`?

I have tried to save new tables under the name table_i, table_[i] and also paste("table", i, sep = "_"), but nothing seems to work. This is what I have now.

for (i in 2010:2016) {
df %>%
  filter(df$year == i)  ->  table_i}

I would like to have 7 tables called table_2010, table_2011, .., table_2016.

Andronicus
  • 25,419
  • 17
  • 47
  • 88
Zuzana
  • 1
  • 2
    Welcome to StackOverflow! Can you add a tag for what language this is in? That will help people who know the language to see your question more quickly. – aschultz Aug 15 '19 at 14:36
  • Is this R? If so, [this question](https://stackoverflow.com/questions/2679193/how-to-name-variables-on-the-fly) has some excellent advice on your situation. – A. S. K. Aug 15 '19 at 14:55
  • Possible duplicate of [How to name variables on the fly?](https://stackoverflow.com/questions/2679193/how-to-name-variables-on-the-fly) – A. S. K. Aug 15 '19 at 14:55

0 Answers0