How to set maximum recursion depth?

I execute R code with a recursion depth of 5000 and I get the following error:

Mistake: evaluation nested too deep: infinite recursion / parameters (expressions =)?
Migration error: evaluation nested too deep: infinite recursion / options (expressions =)?

How to set recursion depth in R?

+7
source share
2 answers

Oh. I dialed it by reading the error message. This will set the recursion depth to 100000

> options(expressions= 100000) 
+13
source

I have tried this. You can install it and, again using "options ()", show that it is installed:

options (expressions = 255) options () .... $ expressions [1] 255 ....

But, unfortunately, this does not work. Recursion fails in exactly the same way. I tried to remove many extra columns from my data, but that didn't help.

Initially, I solved this problem with the for () loop, but it has about 70 thousand data lines, and, as any experienced R programmer knows, you are doomed to very long runs after adding a for () loop with a large set data ..

This is version R 3.4.1 running on 64-bit Windows.

-1
source

Source: https://habr.com/ru/post/976934/


All Articles