0

I would like to use an R method such as

    withTimeout(func,timeout=30)

to interrupt a potentially time consuming R library function which calls a C++ library function. This function does not check for R interrupts.

I have already figured out that this cannot be done in RStudio. Is there a way to do this in another IDE, or in native R?

mto_19
  • 135
  • 6
  • 1
    R code can't interrupt C code: https://stackoverflow.com/questions/7891073/time-out-an-r-command-via-something-like-try – MrFlick Jul 05 '18 at 15:40
  • Considering many (all?) IDEs call R in a fashion similar to RStudio, I am not confident that you'll get different results. – r2evans Jul 05 '18 at 15:40
  • You just have to kill the entire process tree. So save your data before running the problematic calls, then kill everything and reload as necessary. – Hack-R Jul 05 '18 at 15:45
  • I'm aware of the option of killing the process tree. I hoped there was a more convenient way of terminating the c++ code which allowed R to continue afterwards. Since the above comments imply that this cannot be done inside R, I'll look for OS solutions. – mto_19 Jul 05 '18 at 15:59

0 Answers0