1

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?

1

1 Answer 1

1

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)
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.