Can I tell quarto to display the entire code block before it displays all the output? I am writing an example for students and the code block ends with a comment. As it stands when the code runs it prints code, then the output and then the comment code.
library(palmerpenguins)
suppressPackageStartupMessages(library(dplyr))
library(purrr)
suppressPackageStartupMessages(library(janitor))
palmerpenguins::penguins |>
select(where(~ is.factor(.x) | is.character(.x))) |>
imap(~ {
dat <- janitor::tabyl(.x)
names(dat)[1] <- .y
dat
})
# Add a pipe above and use pluck() to extract a table
# }) |>
# pluck("species")
So I want it to show the entire code block first and then the output. Can I do that or do I need to duplicate those lines and then have it print the code the without executing it and then execute the code without printing it?