File: getLower.Rd

package info (click to toggle)
r-cran-paramhelpers 1.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 992 kB
  • sloc: ansic: 102; sh: 13; makefile: 2
file content (67 lines) | stat: -rw-r--r-- 2,176 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/getBounds.R
\name{getLower}
\alias{getLower}
\alias{getUpper}
\alias{getValues}
\title{Get lower / upper bounds and allowed discrete values for parameters.}
\usage{
getLower(obj, with.nr = FALSE, dict = NULL)

getUpper(obj, with.nr = FALSE, dict = NULL)

getValues(obj, dict = NULL)
}
\arguments{
\item{obj}{(\code{\link[=Param]{Param()}} | \code{\link[=ParamSet]{ParamSet()}} | \code{list})\cr
Parameter, parameter set or list of parameters, whose boundaries and/or
values should be extracted. In case the boundaries or values contain
expressions, they will be evaluated using the provided dictionary \code{dict}.}

\item{with.nr}{(\code{logical(1)})\cr
Should number from 1 to length be appended to names of vector params?
Default is \code{FALSE}.}

\item{dict}{(\code{environment} | \link{list} | \code{NULL})\cr
Environment or list which will be used for evaluating the variables of
expressions within a parameter, parameter set or list of parameters. The
default is \code{NULL}.}
}
\value{
\code{vector} | \code{list}. Named by parameter ids.
}
\description{
\code{getLower} and \code{getUpper} return a numerical vector of lower and
upper bounds, \code{getValues} returns a list of possible value sets for discrete
parameters.

Parameters for which such bound make no sense - due to their type - are not
present in the result.
}
\examples{
ps = makeParamSet(
  makeNumericParam("u"),
  makeDiscreteParam("v", values = c("a", "b")),
  makeIntegerParam("w", lower = expression(ceiling(p / 3)), upper = 2),
  makeDiscreteParam("x", values = 1:2),
  makeNumericVectorParam("y", len = 2, lower = c(0, 10), upper = c(1, 11)),
  keys = "p"
)
getLower(ps, dict = list(p = 7))
getUpper(ps)

ps = makeParamSet(
  makeNumericParam("u"),
  makeDiscreteParam("w", values = list(a = list(), b = NULL))
)
getValues(ps)

par.vals = list(
  u = makeNumericParam("u"),
  v = makeIntegerParam("v", lower = 1, upper = 2),
  w = makeDiscreteParam("w", values = 1:2),
  x = makeNumericVectorParam("x", len = 2, lower = c(3, 1), upper = expression(n))
)
getLower(par.vals)
getUpper(par.vals, dict = list(n = 12))
}