在后台运行 R 函数

Vin*_*oth 0 r

您好,我有 R 函数,我通常使用以下命令从 R 工作室调用它

source("test.R")

test()
Run Code Online (Sandbox Code Playgroud)

这是一项长时间运行的工作,我想在后台运行它,这样即使我注销或关闭 R 工作室,它仍然会运行。

请告诉我如何实现这一目标。

Hen*_*ikB 5

You can use the future package (I'm the author) for this, e.g.

library("future")
plan(multisession)

# non-blocking
res %<-% test()

something_else()
Run Code Online (Sandbox Code Playgroud)