Learn R Programming

mizer (version 2.2.1)

validEffortVector: Return valid effort vector

Description

A valid effort vector is a named vector with one entry for each gear, with the gear names in the same order as in the params object.

Usage

validEffortVector(effort, params)

Arguments

effort

An vector or scalar.

params

A MizerParams object

Value

A valid effort vector with one entry for each gear, named by gear, in the same order as in the params object.

Details

The function also accepts an effort that is not yet valid:

  • a scalar, which is then replicated for each gear

  • an unnamed vector, which is then assumed to be in the same order as the gears in the params object

  • a named vector in which the gear names have a different order than in the params object. This is then sorted correctly.

  • a named vector which only supplies values for some of the gears. The effort for the other gears is then set to zero.

An effort argument will lead to an error if it is either

  • unnamed and of the wrong length

  • named but where some names do not match any of the gears

  • not numeric