How to set max ppsize in R?

前端 未结 4 484
后悔当初
后悔当初 2020-12-08 23:10

I am experiencing an error in R that says:

> Error: protect(): protection stack overflow

I have learned through googling that I need to

相关标签:
4条回答
  • 2020-12-08 23:48

    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.

    0 讨论(0)
  • 2020-12-08 23:56

    My way to fix a problem similar to yours:

    1. in the command-line, cd into the location of R progranm (e.g. C:\Program Files\R\R-3.1.3\bin\x64)
    2. in the command-line, Rgui.exe --max-ppsize=500000
    3. in the new open Rgui.exe, options("expressions"=20000)

    Do the coding... NO original Error for me!!

    0 讨论(0)
  • 2020-12-09 00:10

    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.

    0 讨论(0)
  • 2020-12-09 00:10

    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)
    
    0 讨论(0)
提交回复
热议问题