Learn R Programming

commandr (version 1.0.1)

Stage-class: Stage: Abstract Step in a Pipeline

Description

A Stage object represents a role to be played by protocols in a pipeline. In other words, a stage is an abstract step that transforms one data type into another. The transformation may be implemented in a number of ways, each corresponding to a protocol. Users normally do not have to interact with this object. Developers can define new types of stages with setStage.

Arguments

Constructors

Stage(role): Creates a stage object given the role name.

Accessors

role(object): Gets the name of the role represented by this stage.
displayName(object): Gets the name for displaying this stage in a user interface.
inType(object): Gets the class of data that protocols of this stage accept as input.
outType(object): Gets the class of data that protocols of this stage yield as output.
defaultMethod(object): Gets the name of the default method associated with the role of this stage. If not explicitly set, this becomes the first protocol registered for the stage.
defaultMethod(object) <- value: Sets the name of the default method associated with the role of this stage.
methodNames(object, where = topenv(parent.frame())): Gets the names of the methods for this stage, looking in where for the protocol classes.

See Also

setStage for defining new types of stages

Examples

Run this code
setStage("average", "Average Numbers", intype = "numeric")
setProtocol("mean", fun = mean, parent = "average")
setProtocol("median", fun = median, parent = "average")

stage <- Stage("average")
stage

defaultMethod(stage)
defaultMethod(stage) <- "median"
defaultMethod(stage)

Run the code above in your browser using DataLab