Skip to content

Using the `watch.R` file

Zoë Turner edited this page Sep 11, 2026 · 1 revision

We can use the watch.R file in RStudio to launch the Shiny app in the background which then watches the files for changes and can set off an auto-reload. The method for doing this depends on your IDE.

In RStudio:

  1. Open the dev/watch.R script and go to the ‘Background Jobs’ tab of the console pane and click the ‘Start Background Job’ button.
  2. Click ‘Start’ after checking that the ‘R Script’ path is pre-populated with the path to watch.R (otherwise select it yourself).
  3. When ready, a message will tell you to visit http://.../ in your browser.

Why use a Background Job if using RStudio?

  • Your main R console remains free.
  • The watcher process keeps running independently.
  • You can continue running tests, inspecting objects, or editing code in the main session.
  • If the app crashes, it doesn't necessarily take down your interactive workspace.

The use of Background Jobs are mostly a convenience rather than a requirement but can be very helpful when developing apps.

Clone this wiki locally