# Create a specification object.
specification <- Specification$new()
# Set the number of cores.
specification$set_cores(cores = 4)
# Set the cluster type.
specification$set_type(type = "psock")
# Get the number of cores.
specification$cores
# Get the cluster type.
specification$type
# Attempt to set too many cores.
specification$set_cores(cores = 100)
# Check that the cores were reasonably set.
specification$cores
# Allow the object to determine the adequate cluster type.
specification$set_type(type = NULL)
# Check the type determined.
specification$type
# Attempt to set an invalid cluster type.
specification$set_type(type = "invalid")
# Check that the type was set to `psock`.
specification$type
Run the code above in your browser using DataLab