# after v1.0.0

0

0th

Percentile

## Run Code in the Background

Run an R function in the background, possibly after a delay. The current version uses the Tcl event loop and was ported from the 'tcltk2' package.

# after

Run Code in the Background

Run an R function in the background, possibly after a delay. The current version uses the Tcl event loop and was ported from the 'tcltk2' package.

## Installation

source("https://install-github.me/gaborcsardi/after")


## Usage

library(after)


Run a function five seconds later:

after(5000, function() cat("Here I am!\n"))


Call a function in a package. It is good practice to create an anonymous function for this:

after(5000, function() utils::alarm())


Run a function every three seconds:

id <- after(3000, function() cat("Still here!\n"), redo = Inf)
Sys.sleep(10)

Still here!
Still here!
Still here!


Cancel it:

after\$cancel(id)