Create parameters that consist of multiple numbers. If an attempt is made to create a parameter with conflicting settings then an error will be thrown.

proportion_parameter_array(name, value, label)

binary_parameter_array(name, value, label)

integer_parameter_array(
  name,
  value,
  label,
  lower_limit = rep(as.integer(-.Machine$integer.max), length(value)),
  upper_limit = rep(as.integer(.Machine$integer.max), length(value))
)

numeric_parameter_array(
  name,
  value,
  label,
  lower_limit = rep(.Machine$double.xmin, length(value)),
  upper_limit = rep(.Machine$double.xmax, length(value))
)

Arguments

name

character name of parameter.

value

numeric vector of values.

label

character vector of labels for each value.

lower_limit

numeric vector of values denoting the minimum acceptable value for each element in value. Defaults to the smallest possible number on the system.

upper_limit

numeric vector of values denoting the maximum acceptable value for each element in value. Defaults to the largest possible number on the system.

Value

ArrayParameter object.

Details

Below is a list of parameter generating functions and a brief description of each.

proportion_parameter_array

a parameter that consists of multiple numeric values that are between zero and one.

binary_parameter_array

a parameter that consists of multiple integer values that are either zero or one.

integer_parameter_array

a parameter that consists of multiple integer values.

numeric_parameter_array

a parameter that consists of multiple numeric values.

Examples

# proportion parameter array
p1 <- proportion_parameter_array('prop_array', c(0.1, 0.2, 0.3),
                                 letters[1:3])
print(p1) # print it
#> prop_array (min: 0.1, max: 0.3)
p1$get() # get value
#>   value
#> a   0.1
#> b   0.2
#> c   0.3
p1$id # get id
#> id: d18a17cf-cf95-4fd2-b36c-c0589d4c9efe
invalid <- data.frame(value = 1:3, row.names=letters[1:3]) # invalid values
p1$validate(invalid) # check invalid input is invalid
valid <- data.frame(value = c(0.4, 0.5, 0.6), row.names=letters[1:3]) # valid
p1$validate(valid) # check valid input is valid
p1$set(valid) # change value to valid input
print(p1)
#> prop_array (min: 0.4, max: 0.6)

# binary parameter array
p2 <- binary_parameter_array('bin_array', c(0L, 1L, 0L), letters[1:3])
print(p2) # print it
#> bin_array (min: 0, max: 1)
p2$get() # get value
#>   value
#> a     0
#> b     1
#> c     0
p2$id # get id
#> id: 70f647fe-5be4-4a4d-9da3-978f165e2247
invalid <- data.frame(value = 1:3, row.names=letters[1:3]) # invalid values
p2$validate(invalid) # check invalid input is invalid
valid <- data.frame(value = c(0L, 0L, 0L), row.names=letters[1:3]) # valid
p2$validate(valid) # check valid input is valid
p2$set(valid) # change value to valid input
print(p2)
#> bin_array (min: 0, max: 0)

# integer parameter array
p3 <- integer_parameter_array('int_array', c(1:3), letters[1:3])
print(p3) # print it
#> int_array (min: 1, max: 3)
p3$get() # get value
#>   value
#> a     1
#> b     2
#> c     3
p3$id # get id
#> id: 775f47e5-9569-414e-9967-af9e74e7d1e3
invalid <- data.frame(value = rnorm(3), row.names=letters[1:3]) # invalid
p3$validate(invalid) # check invalid input is invalid
valid <- data.frame(value = 5:7, row.names=letters[1:3]) # valid
p3$validate(valid) # check valid input is valid
p3$set(valid) # change value to valid input
print(p3)
#> int_array (min: 5, max: 7)

# numeric parameter array
p4 <- numeric_parameter_array('dbl_array', c(0.1, 4, -5), letters[1:3])
print(p4) # print it
#> dbl_array (min: -5, max: 4)
p4$get() # get value
#>   value
#> a   0.1
#> b   4.0
#> c  -5.0
p4$id # get id
#> id: 1a6a7cf0-0883-4d86-a298-8d3b35cc908a
invalid <- data.frame(value = c(NA, 1, 2), row.names=letters[1:3]) # invalid
p4$validate(invalid) # check invalid input is invalid
valid <- data.frame(value = c(1, 2, 3), row.names=letters[1:3]) # valid
p4$validate(valid) # check valid input is valid
p4$set(valid) # change value to valid input
print(p4)
#> dbl_array (min: 1, max: 3)

# numeric parameter array with lower bounds
p5 <- numeric_parameter_array('b_dbl_array', c(0.1, 4, -5), letters[1:3],
                              lower_limit=c(0, 1, 2))
print(p5) # print it
#> b_dbl_array (min: -5, max: 4)
p5$get() # get value
#>   value
#> a   0.1
#> b   4.0
#> c  -5.0
p5$id# get id
#> id: a215b3e5-f669-4ec7-8e57-d33f3e43625f
invalid <- data.frame(value = c(-1, 5, 5), row.names=letters[1:3]) # invalid
p5$validate(invalid) # check invalid input is invalid
valid <- data.frame(value = c(0, 1, 2), row.names=letters[1:3]) # valid
p5$validate(valid) # check valid input is valid
p5$set(valid) # change value to valid input
print(p5)
#> b_dbl_array (min: 0, max: 2)