rstudio - is it possible to run a code in the background

前端 未结 4 1177
无人及你
无人及你 2021-02-03 23:09

Question regarding RStudio. Suppose I am running a code in the console:

> code1()

assume that code1() prints nothing on the con

4条回答
  •  一生所求
    2021-02-03 23:54

    The future package (I'm the author) provides this:

    library("future")
    plan(multisession)
    
    future(code1())
    code2()
    

    FYI, if you use

    plan(cluster, workers = c("n1", "n3", "remote.server.org"))
    

    then the future expression is resolved on one of those machines. Using

    plan(future.BatchJobs::batchjobs_slurm)
    

    will cause it to be resolved via a Slurm job scheduler queue.

    This question is closely related to Run asynchronous function in R

提交回复
热议问题