Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Reference a Variable Within Quotations [duplicate]

$
0
0

This question already has an answer here:

I have a plot I am trying to save to a PNG for a bunch of different objects in a list of lists. The code looks something like this:

ggsave("image.png", plot = plotscombined, width = 11, height =5)

I want it to so that every object in the list has its own plot with its own name. I thought this would be easy, as I have a list of the objects, and I was going to reference it as such through a loop:

ggsave(list[i].png, plot = plotscombined, width = 11, height =5)

However, I realize this is not an option. So, could anybody explain how this could be done? I know, I know, loops are bad in R when there are vectorized methods, but there's a big chunk of my code that needs a loop, so I would rather find a way without altering a lot of my code.

Thanks!


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>