Creates an interactive stopwatch 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::stopwatch()" R
Usage
stopwatch(
target_time = NULL,
start_color = NULL,
end_color = NULL,
sound = NULL,
units = "minutes"
)
Arguments
- target_time
[numeric(1)]
Iftarget_time
is notNULL
, the stopwatch will change colors fromstart_color
toend_color
and playsound
whentarget_time
is reached. Defaults toNULL
.- 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 Stopwatch
.