HARPgroup / HARParchive

This repo houses HARP code development items, resources, and intermediate work products.
1 stars 0 forks source link

small tweaks to get interwoven tables and maps to show using code from VWP_CIA_Summary.Rmd #1228

Closed rburghol closed 2 months ago

rburghol commented 2 months ago

@EllaF21 @gmahadwar @COBrogan I have made some tweaks to Ella's branch (see PR #1223 and issue #1222 ), to enable interweaving tables and maps. It worked out nicely, I cribbed some code from the VWP summary script (note: this script does a ton and there seems to be a number of techniques employed in it that solve some frustrating Rmd stuff, so it is a great resource).

The main tweaks I made was to

If you all can check this out and see if it runs and does what you want let me know. @EllaF21 I made this PR against your branch so that you can merge it in your self.

COBrogan commented 2 months ago

These changes worked for me. My preliminary stack overflow searches were pointing to the same fix (but you beat me to it!). It's pretty neat. While include_graphics() may not work in loops, we still have the option to just store the plot as print via as-is. I think the main "limitation" with this method is that we cannot directly control the size of the image in the cat() call while rendering to a word or PDF document (these were optional inputs to include_graphics(). However, we can easily get around this by simply setting up the plots to the intended size and we can functionalize the plot output to be whatever image size we may need. We've already done that here to the extent needed, so just included this note for the future. I think Rob's code here is definitely the way to go when we need to print from future loops or nested if statements within an Rmd.

Thanks for linking the VWP Summary Script. After going through it a bit, I totally agree there is some cool code within to get around Rmd issues.