我正在尝试设置所需的计划,但遇到以下错误:
no_cores <- availableCores() - 2
plan(multisession, workers = no_cores, lazy = T, gc = T)错误是:
Error in MultisessionFuture(expr = expr, envir = envir, substitute = FALSE, :
argument "expr" is missing, with no default或者:
plan(multisession, workers = no_cores, lazy = T, gc = T)
Error in tweak.future(function (expr, envir = parent.frame(), substitute = TRUE, :
Future argument 'lazy' must not be tweaked / set via plan()请告诉我如何设置multisession/multicore计划的workers、lazy、gc等参数。
我的R版本是:
R.Version()
$platform
[1] "x86_64-pc-linux-gnu"
$arch
[1] "x86_64"
$os
[1] "linux-gnu"
$system
[1] "x86_64, linux-gnu"
$status
[1] ""
$major
[1] "4"
$minor
[1] "0.2"
$year
[1] "2020"
$month
[1] "06"
$day
[1] "22"
$`svn rev`
[1] "78730"
$language
[1] "R"
$version.string
[1] "R version 4.0.2 (2020-06-22)"
$nickname
[1] "Taking Off Again"发布于 2020-09-20 02:03:14
尝试您的示例时,我得到了第二条错误消息。我基本上遵循了给出的建议:在plan中设置参数lazy = T,这是不允许的。但是,您可以直接在furrr函数调用中设置此参数:
library(furrr)
no_cores <- availableCores() - 2
plan(multisession, workers = no_cores, gc = T)
future_map(c("hello", "world"), ~.x,
.options = future_options(lazy = TRUE))
[[1]]
[1] "hello"
[[2]]
[1] "world"https://stackoverflow.com/questions/63970821
复制相似问题