Issue
Users may encounter the following issue when working with R Markdown or Quarto documents in Posit Cloud:
Code chunks labeled as 'setup' may not execute in the expected order when running chunks individually.
Description
When a code chunk is labeled with 'setup', the RStudio IDE gives it special treatment. By default, setup chunks are executed first to ensure proper environment initialization, even if you click to run a different chunk. This can cause confusion when running chunks interactively.
Solution
You have three options to control setup chunk behavior:
- Remove or rename the 'setup' label from the chunk.
- Move the 'setup' label to the first chunk that should run first.
- Disable automatic setup chunk execution in IDE settings: Tools → Global Options → R Markdown → uncheck "Execute setup chunk automatically in notebooks".
If you're still having issues, you can reach out to Support by opening a ticket here.