0

In R Bookdown I have generated a list of plots (ggplots). I want to show them all, so I just write the name of the variable

ListOfPlots

But I get the names of the list like

    #
    # ListOfPlots$plot1

    (Plot 1)



    #  
    # ListOfPlots$plot2

    (Plot 2)

How can I avoid the text?

Javi_VM
  • 505
  • 2
  • 10
  • 3
    You could set `echo = F`, or do something like `invisible(sapply(ListOfPlots, print))` – Gregor Thomas Mar 05 '18 at 20:34
  • `echo=F ` dooes not work. I'll try the other – Javi_VM Mar 06 '18 at 08:41
  • The second actually worked. You couldd post it as an answer so that I can mark it as the correct answer @Gregor – Javi_VM Mar 06 '18 at 19:01
  • Ah sorry - echo applies to the input commands, not the results. But the `results = "hide"` chunk option should work (assuming you don't have other text results you want printed in that chunk). – Gregor Thomas Mar 06 '18 at 19:16

1 Answers1

1

You can wrap a call in invisible to suppress some default return printing. For your list of plots:

invisible(sapply(ListOfPlots, print))
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294