Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

futureOf

Get the future of a future variable


Description

Get the future of a future variable that has been created directly or indirectly via future().

Usage

futureOf(
  var = NULL,
  envir = parent.frame(),
  mustExist = TRUE,
  default = NA,
  drop = FALSE
)

Arguments

var

the variable. If NULL, all futures in the environment are returned.

envir

the environment where to search from.

mustExist

If TRUE and the variable does not exists, then an informative error is thrown, otherwise NA is returned.

default

the default value if future was not found.

drop

if TRUE and var is NULL, then returned list only contains futures, otherwise also default values.

Value

A Future (or default). If var is NULL, then a named list of Future:s are returned.

Examples

a %<-% { 1 }

f <- futureOf(a)
print(f)

b %<-% { 2 }

f <- futureOf(b)
print(f)

## All futures
fs <- futureOf()
print(fs)


## Futures part of environment
env <- new.env()
env$c %<-% { 3 }

f <- futureOf(env$c)
print(f)

f2 <- futureOf(c, envir = env)
print(f2)

f3 <- futureOf("c", envir = env)
print(f3)

fs <- futureOf(envir = env)
print(fs)

future

Unified Parallel and Distributed Processing in R for Everyone

v1.21.0
LGPL (>= 2.1)
Authors
Henrik Bengtsson [aut, cre, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.