class-utils: Set default slot values

Description Usage Arguments Details Value Author(s) Examples

Description

A utility function to set slots to default values if their values are not provided to initialize methods.

Usage

1
.emptyDefault(args, field, default)

Arguments

args

A named list of arguments to pass to the initialize method for a given class.

field

String specifying the field to set.

default

The default value of the slot in field.

Details

A more natural approach would be to have the default values in the arguments of the initialize method. However, this would require us to hard-code the slot names in the function signature, which would break our current DRY model of only specifying the slot names once.

Value

args is returned with the named field set to default if it was previously absent.

Author(s)

Aaron Lun, Kevin Rue-Albrecht

Examples

1
showMethods("initialize", classes = "ReducedDimensionPlot", includeDefs = TRUE)

iSEE documentation built on Feb. 3, 2021, 2:01 a.m.