Skip to contents

This infix operator can be used to create a background job for a block of code in RStudio/Posit and, once completed, all objects created in the block of code are imported into the global environment.

Usage

lhs %{}% rhs

Arguments

lhs

not used, see details and examples

rhs

the block of code that you want to run

Value

prints the ID of the background job in the console and, once completed, the objects created in the block of code are imported into the global environment

Details

You can use this infix operator in two different ways. Either you set the left-hand side to NULL or you use the syntax `%{}%` ({BlockOfCode})

Examples

# Can only be executed in Rstudio
if (FALSE) {
NULL %{}% {
 x = rnorm(1e7)
 y = rnorm(1e7)
}
`%{}%` ({
 x = rnorm(1e7)
 y = rnorm(1e7)
})
}