This is base on the following rule: use only physical cores and if you have only physical cores, leave one core for the OS/UI.

nb_cores()

Value

The recommended number of cores to use.

Examples

nb_cores()
#> [1] 2