Creates an interactive timer in your R session. I recommend you don't call this function in your current R session, as it will block the console. You may consider running it from the command line in a new terminal window with
-e "breaktime::timer()" R
Usage
timer(
duration,
start_color = "green",
end_color = "red",
sound = "ping",
units = "minutes"
)
Arguments
- duration
[numeric(1)]
The length of the timer.- start_color, end_color
[character(1)]
Colors used to display the time. The time is displayed instart_color
when there is time remaining, and inend_color
when the timer has expired. Passed tocli::make_ansi_style()
. Defaults to"green"
and"red"
, respectively.- sound
[numeric(1)]
or[character(1)]
The sound played bybeepr::beep()
when a timer ends. Seebeepr::beep()
for possible values.If
NULL
, sound is disabled.If a timer has expired and hasn't been ended, the sound will play again each time one-fifth of the target time passes (for example, if a session lasts 25 minutes, a reminder sound will play every 5 minutes after the session ends).
- units
[character(1)]
Units used when interpreting numeric time period arguments. Defaults to"minutes"
. Accepted units are"seconds"
,"minutes"
,"hours"
,"days"
,"weeks"
,"fortnights"
,"months"
,"years"
,"decades"
,"centuries"
, or"millennia"
(or abbreviations thereof).
Value
Invisibly returns an R6 object of class Timer
.