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

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)
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     1
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’

b %<-% { 2 }

f <- futureOf(b)
print(f)
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     2
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’

## All futures
fs <- futureOf()
print(fs)
#> $a
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     1
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
#> 
#> $b
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     2
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
#> 
#> $f
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     2
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
#> 


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

f <- futureOf(env$c)
print(f)
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     3
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’

f2 <- futureOf(c, envir = env)
print(f2)
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     3
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’

f3 <- futureOf("c", envir = env)
print(f3)
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     3
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’

fs <- futureOf(envir = env)
print(fs)
#> $c
#> SequentialFuture:
#> Label: ‘<none>’
#> Expression:
#> {
#>     3
#> }
#> Lazy evaluation: FALSE
#> Asynchronous evaluation: FALSE
#> Local evaluation: TRUE
#> Environment: 0x55beb95463e0
#> Capture standard output: TRUE
#> Capture condition classes: ‘condition’ (excluding ‘nothing’)
#> Globals: <none>
#> Packages: <none>
#> L'Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
#> Resolved: TRUE
#> Value: 56 bytes of class ‘numeric’
#> Early signaling: FALSE
#> Owner process: 097b8923-5f94-5450-c5f8-0de06133f79c
#> Class: ‘SequentialFuture’, ‘UniprocessFuture’, ‘Future’, ‘environment’
#>