I am experiencing an error in R that says:
> Error: protect(): protection stack overflow
I have learned through googling that I need to
The stack overflow might be a problem of too deep recursion, you might have a problem with a function calling itself recursively too many times, e.g. missing exit condition. In that case there's no point in increasing stack size, it will run out sooner or later anyway.
My way to fix a problem similar to yours:
Do the coding... NO original Error for me!!
I found a similar problem and that the actual issue was related to expansion of formulas into a model matrix. If you can get the data into that format without using formulas and then use the overload in the svm command (like many other models) that takes an X and y value instead, your probably may go away like mine did.
On my Windows 10 laptop, I ran into this same issue running a tSNE analysis on a 945 x 22123 data.frame
with Rtsne
. Even after following the steps above to increase the ppsize and expressions (with Rstudio.exe
substituted for Rgui.exe
), I still got: > Error: protect(): protection stack overflow
On another thread I found the recommendation to use a matrix instead of a data.frame
because the Rtsne function will have to convert to matrix anyhow and thus hold both the data.frame
and the converted matrix
in memory simultaneously. The easy fix was to change from:
tsne1 <- Rtsne(df, dims = 2, pca = TRUE)
to:
tsne1 <- Rtsne(as.matrix(df), dims = 2, pca = TRUE)