Skip to content

Instantly share code, notes, and snippets.

@ColinFay
Last active December 6, 2024 16:05
Show Gist options
  • Save ColinFay/4cb360a6d0d28610c71da11f4de57d50 to your computer and use it in GitHub Desktop.
Save ColinFay/4cb360a6d0d28610c71da11f4de57d50 to your computer and use it in GitHub Desktop.
library(future)
library(future.apply)
plan(
strategy = multisession,
workers = 3
)
future_lapply(
c("1", 12, NA),
\(x){
# Mimicking some computational time
Sys.sleep(1)
sprintf("I'm %s", x)
}
)
lapply(
c("1", 12, NA),
\(x) {
Sys.sleep(1) # Simulate computational time
sprintf("I'm %s", x)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment