protect(): protection stack overflow
Windows-specific ( not work for UNIX-like systems )
memory.limit(size=8000000)
Unix-like system
http://r.789695.n4.nabble.com/R-3-5-0-vector-memory-exhausted-error-on-readBin-td4750237.html
set the $R_MAX_VSIZE environmental variable prior to running RStudio
https://stat.ethz.ch/R-manual/R-devel/library/base/html/Memory.html
Additionally, ‘–max-ppsize’ controls the maximum size of the protection stack
https://stackoverflow.com/questions/32826906/how-to-solve-protection-stack-overflow-issue-in-r-studio
via your .Rprofile
or at runtime by using the options(expressions = 5e5)
command.
options(expressions = 5e5)
For UNIX or Linux systems, we will want to set the $R_MAX_VSIZE environmental variable prior to running RStudio or R from the cli. See the following thread for more info on solving this problem:
https://www.researchgate.net/post/error_protect_protection_stack_overflow_in_R‘
> dd %>% dim [1] 12 39319
to change the data from data.frame to matrix form.
==========================================================
You probably have to set –max-ppsize See http://stat.ethz.ch/R-manual/R-devel/library/base/html/Memory.html You’ll also find some discussions about this on StackOverflow. See http://stackoverflow.com/questions/28728774/how-to-set-max-ppsize-in-r for instance ================================ ‘memory.limit’ function recommended by Maurizio may work for some users, but it is Windows-specific, and thus will not work for UNIX-like systems. For UNIX or Linux systems, we will want to set the $R_MAX_VSIZE environmental variable prior to running RStudio or R from the cli. See the following thread for more info on solving this problem: http://r.789695.n4.nabble.com/R-3-5-0-vector-memory-exhausted-error-on-readBin-td4750237.html Another option to for UNIX/Linux users to try when they get the protect error is the ‘options’ expressions setting, e.g.: options(expressions = 5e5) as recommended at the following URL: https://stackoverflow.com/questions/32826906/how-to-solve-protection-stack-overflow-issue-in-r-studio Additionally, ‘–max-ppsize’ controls the maximum size of the protection stack, as per the Memory entry in the manual, at the following URL: https://stat.ethz.ch/R-manual/R-devel/library/base/html/Memory.html ==================================================================================
ranger(formula = NULL, data = NULL, num.trees = 500, mtry = NULL, importance = "none", write.forest = TRUE, probability = FALSE, min.node.size = NULL, replace = TRUE, sample.fraction = ifelse(replace, 1, 0.632), case.weights = NULL, class.weights = NULL, splitrule = NULL, num.random.splits = 1, alpha = 0.5, minprop = 0.1, split.select.weights = NULL, always.split.variables = NULL, respect.unordered.factors = NULL, scale.permutation.importance = FALSE, keep.inbag = FALSE, holdout = FALSE, quantreg = FALSE, num.threads = NULL, save.memory = FALSE, verbose = TRUE, seed = NULL, dependent.variable.name = NULL, status.variable.name = NULL, classification = NULL)
Arguments
formula |
Object of class formula or characterdescribing the model to fit. Interaction terms supported only for numerical variables. |
data |
Training data of class data.frame, matrix, dgCMatrix (Matrix) or gwaa.data(GenABEL). |
Coercion of matrix to sparse matrix (dgCMatrix) and maintaining dimnames.
http://gallery.rcpp.org/articles/sparse-matrix-coercion/
https://github.com/imbs-hl/ranger/issues/135
library(ranger) library(Matrix) iris_sparse <- Matrix(data.matrix(iris), sparse = TRUE) ranger(data = iris_sparse, dependent.variable.name = "Species", classification = TRUE)