NoSleepR, a small utility package that prevents your machine from going to sleep while long-running R code is executing, and restores normal sleep behavior when it finishes (or errors).
The goal is to avoid situations where a laptop or desktop suspends itself in the middle of a long job, without having to change global power settings.
Basic usage:
#install.packages("NoSleepR")
library(NoSleepR)
with_nosleep({
# long-running R code here
})
Or enable it for the whole session:
nosleep_on(keep_display = FALSE)
# long-running R code here
nosleep_off()
- Cross-platform: Windows, macOS, Linux
- Lightweight: No external system configuration required
- Optional
keep_displaymode to prevent screen from turning off.
Repo: GitHub - hetalang/NoSleepR: R package to prevent sleep mode
Feedback and edge-case reports are very welcome.
(Disclosure: I'm the author of the package.)