README.md

after

Run Code in the Background

Linux Build Status Windows Build status CRAN RStudio mirror downloads Coverage Status

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)

License

LGPL-3 © Gábor Csárdi



gaborcsardi/after documentation built on May 16, 2019, 4:07 p.m.