Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides correcting R code for mirai async, parallel, and distributed evaluation, covering dependencies, workers, mirai_map, cluster setup.
36% 100%+64 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 8 of 22 without it.
3 of 3 safety checks passed
Not used yet
mirai is a minimalist R framework for async, parallel, and distributed evaluation, built on nanonext.
mirai evaluates expressions in a clean environment on a daemon process. Nothing from the calling environment is available unless passed explicitly — this is the #1 source of mistakes.
# WRONG: my_data and my_func are not available on the daemon
m <- mirai(my_func(my_data))
There are two ways to pass objects, and the names used must match the names referenced in the expression.
.args (recommended)Objects in .args populate the expression's local evaluation environment — available directly by name inside the expression.
m <- mirai(my_func(my_data), .args = list(my_func = my_func, my_data = my_data))
... (dot-dot-dot)Objects passed via ... are assigned to the daemon's global environment. Use this when objects need to be found by R's standard scoping rules (e.g., helper functions called by other functions).
m <- mirai(my_func(my_data), my_func = my_func, my_data = my_data)
# .args form — populates local eval env
process <- function(x, y) mirai(x + y, .args = environment())
# ... form — single unnamed environment, populates daemon global env
df_matrix <- function(x, y) mirai(as.matrix(rbind(x, y)), environment())
Next to this one in the catalogue, plus more from the same author.