Exports multplies ggplots objects with loop

I have 15 different ggplot objects:

but i want exports all graphs with a loop, for example

for (i in 39:53){
  print(x = pi)

the line of

print(x = pi)

is unrecognized. Help.

First of all, pi is considered just as pi only. It is not taking the value of i from the for loop.

If you want to create, for example p39, then use something like paste0("p", i).

But it'll be a string, and you have to tell R to search for the variable with this name. For that you need get.

So, try this: print(get(paste0("p", i)))

Hope this helps.

1 Like

Successfully, thank you very much.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.