Blaszard Blaszard - 9 months ago 39
R Question

Is it feasible to know how much time it takes for a called function to finish on R?

Sometimes, when I decide to process the function, I fear that it takes an infinite amount of time to finish the process, making my working environment occupied for a while (and to make it worse, in some cases disrupting the process by

esc
doesn't work or work only so much later).

So I want to know in advance whether a given function will be finished in an endurable time, and approximately how much it is expected to take to finish the function. This is not a question about how to measure the time it took to complete the function.

So is it possible to know it approximately in advance?

Answer Source

No. This is not possible in R or any other language. Whether or not the program will ever stop is called the "halting problem", and it is provably unsolvable.