Last active
December 6, 2024 16:05
-
-
Save ColinFay/4cb360a6d0d28610c71da11f4de57d50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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