knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, comment = "#>") library(dowhen)
An R package for doing thing when something else happens
Install the development version from Github with:
## install remotes pkg if not already if (!requireNamespace("remotes")) { install.packages("remotes") } ## install from github remotes::install_github("mkearney/dowhen")
do_when()
DO something WHEN something else is true
## wait 5 seconds between attempts do_when(rnorm(10), runif(1) > .25, .s = 5)
do_when_time()
DO something WHEN it's a certain TIME
## set desired time to trigger something good_time <- Sys.time() + 8 ## wait 5 seconds between attempts do_when_time(rnorm(5), good_time, .s = 5)
do_when_file()
DO something WHEN a certain FILE exists
## create "test" file cat("You read my file!", file = "test") ## check for "test" file every minute do_when_file(tfse::readlines("test"), "test", .s = 60) ## remove test file unlink("test")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.