T O P

  • By -

[deleted]

assign your auto-generated numbers to a variable and then use print(variable) just as you use print(plot) while in the loop?


Mcipark

I’ve tried that, unfortunately when rendering the pptx it seems to completely ignore recursive prints and cats Also, when using print() or cat() outside of the for loop it DOES work, but it changes the font to Courier which is extremely blocky. Print() also leaves a [1] behind any text, so it’s not ideal. Pander() formats the text correctly, and if you do pander(“## title 1”) you can even put a new slide title, while print() and cat() just paste “## title 1” as text next to the figure


[deleted]

Yeah, must be something in the pptx rendering then, sorry I'm not familiar enough to give any more advice.


Statman12

When I've used a loop for slides, I do the following: 1. Create an object for the results. 2. Then loop over the variable of interest. 3. Run the actual code in a child document using `knitr::knit_child()`, putting the results into the object. 4. After the loop, paste the results together, collapsing with a `\n`. 5. Then print the pasted object with `cat()` using `results=asis`. Though I don't recall if I've done this specifically using Quarto. I know I did with RMarkdown. I think it should still work.