Learn R Programming

ParamHelpers (version 1.3)

getOptPathBestIndex: Get index of the best element from optimization path.

Description

Get index of the best element from optimization path.

Usage

getOptPathBestIndex(op, y.name = op$y.names[1], dob = op$env$dob,
  eol = op$env$eol, ties = "last")

Arguments

op
[OptPath] Optimization path.
y.name
[character(1)] Name of target value to decide which element is best. Default is y.names[1].
dob
[integer] Possible dates of birth to select best element from. Defaults to all.
eol
[integer] Possible end of life to select best element from. Defaults to all.
ties
[character(1)] How should ties be broken when more than one optimal element is found? all: return all indices, first: return first optimal element in path, last: return last optimal element i

Value

  • [integer] Index or indices into path. See ties.

See Also

Other optpath: OptPath, OptPathDF, makeOptPathDF; addOptPathEl; getOptPathCols; getOptPathCol; getOptPathDOB; getOptPathEOL; getOptPathEl; getOptPathErrorMessages; getOptPathExecTimes; getOptPathLength; getOptPathParetoFront; getOptPathY; setOptPathElDOB; setOptPathElEOL

Examples

Run this code
ps = makeParamSet(makeNumericParam("x"))
op = makeOptPathDF(par.set = ps, y.names = "y", minimize = TRUE)
addOptPathEl(op, x = list(x = 1), y = 5)
addOptPathEl(op, x = list(x = 2), y = 3)
addOptPathEl(op, x = list(x = 3), y = 9)
addOptPathEl(op, x = list(x = 4), y = 3)
as.data.frame(op)
getOptPathBestIndex(op)
getOptPathBestIndex(op, ties = "first")

Run the code above in your browser using DataLab