Learn R Programming

crmPack (version 2.0.0)

h_jags_add_dummy: Appending a Dummy Number for Selected Slots in Data

Description

[Experimental]

A helper function that appends a dummy value to a given slots in GeneralData class object, if and only if the total number of observations (as indicated by object@nObs) equals to 1. Otherwise, the object is not changed.

Usage

h_jags_add_dummy(object, where, dummy = 0)

Value

A GeneralData object with slots updated with dummy number.

Arguments

object

(GeneralData)
object into which dummy values will be added.

where

(character)
names of slots in object to which a dummy number will be appended.

dummy

(number)
a dummy number that will be appended to selected slots in object. Default to 0.

Examples

Run this code
# Create some data of class 'Data'
my_data <- Data(
  x = 0.1,
  y = 0,
  doseGrid = c(0.1, 0.5)
)

my_data_2 <- Data(
  x = c(0.1, 0.5),
  y = c(0, 1),
  doseGrid = c(0.1, 0.5)
)

# Append dummy to `x` and `y`.
h_jags_add_dummy(my_data, where = c("x", "y"))

# Append dummy to `x` and `y`. No effect as `my_data_2@nObs != 1`.
h_jags_add_dummy(my_data_2, where = c("x", "y"))

Run the code above in your browser using DataLab