Skip to content
Run Code in the Background
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
man
tests
.Rbuildignore
.gitignore
.travis.yml
DESCRIPTION
NAMESPACE
NEWS.md
README.md
appveyor.yml

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

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.