# NOT RUN {
message(paste("Number of cores available:", availableCores()))
# }
# NOT RUN {
options(mc.cores = 2L)
message(paste("Number of cores available:", availableCores()))
# }
# NOT RUN {
# }
# NOT RUN {
## Use 75% of the cores on the system but never more than four
options(parallelly.availableCores.custom = function() {
ncores <- max(parallel::detectCores(), 1L, na.rm = TRUE)
min(0.75 * ncores, 4L)
})
message(paste("Number of cores available:", availableCores()))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab