Relative Content

Tag Archive for rc

Is there a way to impose a time limit on a chunk of R code even though a part of the code is running in C?

I have a part of a function which later runs in a loop and I want to impose a time limit on a part of this function. It should return NAs in case the time limit is exceeded to prevent my whole program from running too long. The problem is that the optimisation, a part of the code, runs in C, so withTimeout() from R.utils doesn’t work.
The function I want to time-restrict is ugarchfit() from the rugarch package. The documentation indicated that the optimisation runs in C code for efficiency.

Is there a way to impose a time limit on a chunk of code even though a part of the code is running in C?

I have a part of a function which later runs in a loop and I want to impose a time limit on a part of this function. It should return NAs in case the time limit is exceeded to prevent my whole program from running too long. The problem is that the optimisation, a part of the code, runs in C, so withTimeout() from R.utils doesn’t work.
The function I want to time-restrict is ugarchfit() from the rugarch package. The documentation indicated that the optimisation runs in C code for efficiency.