You can change the maximum recursive depth (e.g. to 10000), with:
options(expressions = 10000)
You can check the current value with:
getOption("expressions")
That being said, if you're iterating over all the elements in a 1000x1000 matrix, you might have a recursive call that is 1000000 deep, and you should probably restructure your code.
I guess it's somewhat amusing this question is being asked on StackOverflow?