Two weeks ago I learned to only implicitly print in R markdown files. Using
x's default print function (the one specific to the type of object it is) for the generic print function. One effect of this, for example, is that a tibble would be printed as plain text rather than as an interactive paged table.
Today I learned that
if is a function, which means that only the final output is printed, just as in any other function. Therefore, to print multiple objects from one if statement, it is necessary to not implicitly print, but to wrap the object in a print function. (The solution proposed here is to continue implicitly printing, but to do so from a child document. I am not yet quite ready to add this complexity if I don't need to.)
⟹ How then, can I find the appropriate print function for a given object, e.g.
rmarkdown:::print.paged_df for nibbles and
print.ggplot for ggplots? (Default
print() works just fine from within RStudio for Rmd files, but not when knit.)