File: getDefaults.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 (46 lines) | stat: -rw-r--r-- 1,762 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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/getDefaults.R
\name{getDefaults}
\alias{getDefaults}
\title{Return defaults of parameters in parameter set.}
\usage{
getDefaults(obj, include.null = FALSE, dict = NULL)
}
\arguments{
\item{obj}{(\code{\link[=Param]{Param()}} | \code{\link[=ParamSet]{ParamSet()}} | \code{list})\cr
Parameter, parameter set or list of parameters, whose defaults should be
extracted. In case the default values contain expressions, they will be
evaluated using the provided dictionary (\code{dict}).}

\item{include.null}{(\code{logical(1)})\cr
Include \code{NULL} entries for parameters without default values in the result
list? Note that this can be slightly dangerous as \code{NULL} might be used as
default value for other parameters. 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{
named \code{list}. Named (and in case of a \code{\link[=ParamSet]{ParamSet()}}, in the same order).
Parameters without defaults are not present in the list.
}
\description{
Return defaults of single parameters or parameters in a parameter set or a list of parameters.
}
\examples{
ps1 = makeParamSet(
  makeDiscreteParam("x", values = c("a", "b"), default = "a"),
  makeNumericVectorParam("y", len = 2),
  makeIntegerParam("z", default = 99)
)
getDefaults(ps1, include.null = TRUE)

ps2 = makeParamSet(
  makeNumericVectorParam("a", len = expression(k), default = expression(p)),
  makeIntegerParam("b", default = 99),
  makeLogicalParam("c")
)
getDefaults(ps2, dict = list(k = 3, p = 5.4))
}