I am using a loop in R in a quarto document
When I render the quarto document via Rstudio, I would like to see in the background jobs how far in the loop the process is.
When I work interactively, this works:
species <- iris$Species |> unique()
for(i in species) {
message(i)
Sys.sleep(2)
}
However, when rendering, no message appears in the Background Jobs pane. I have tried with print()
and cat()
as well.
Is there a workaround to this?
The solution is to add #| message: !expr NA
in the quarto code block.
Read more here: https://github.com/quarto-dev/quarto-cli/discussions/7443
#| message: !expr NA
species <- iris$Species |> unique()
for(i in species) {
message(i)
Sys.sleep(2)
}