job
job copied to clipboard
Using job::job() within RMarkdown file
I am working on compiling one large RMarkdown file that reproduces all of the analyses for a scientific manuscript. A few of the analyses take a long time, so I've used job::job() to run them as jobs, which has worked great when I'm working through the RMarkdown file in RStudio.
But, I'd like to be able to knit the RMarkdown file to html/pdf to share with the manuscript too. But I get an error in the first chunk that includes a job::job() call when trying to render:
Error in check_available()
:
! You must run this from the RStudio main session.
Backtrace:
- job::job(...)
- job:::check_available() Execution halted
Is there something I'm missing that would make it possible to render the RMarkdown even with the job sections? Or is this just fundamentally incompatible?
I think you cannot do this based on these lines:
https://github.com/lindeloev/job/blob/452600154add99982b01bd029e39e3d6f8580d44/R/misc.R#L3-L4
This function only works in an RStudio main session.
Hi @meghanmshea Sorry for the late reply, but @psychelzh is right. For your use case, you may want to look at the IDE-agnostic solutions mentioned under "See also" on https://lindeloev.github.io/job/. Namely {callr}
.