Learn R Programming

crmPack (version 2.1.0)

update,Data-method: Updating Data Objects

Description

[Stable]

A method that updates existing Data object with new data.

Usage

# S4 method for Data
update(
  object,
  x,
  y,
  response = rep(NA_integer_, length(y)),
  ID = length(object@ID) + seq_along(y),
  new_cohort = TRUE,
  check = TRUE,
  backfill = FALSE,
  cohort = NULL,
  ...
)

Value

The new, updated Data object.

Arguments

object

(Data)
object you want to update.

x

(number)
the dose level (one level only!).

y

(integer)
the DLT vector (0/1 vector) for all patients in this cohort. You can also supply numeric vectors, but these will then be converted to integer internally.

response

(integer)
the efficacy response vector (0/1 vector). May contain NA.

ID

(integer)
the patient IDs. You can also supply numeric vectors, but these will then be converted to integer internally.

new_cohort

(flag)
if TRUE (default) the new data are assigned to a new cohort.

check

(flag)
whether the validation of the updated object should be conducted. See details below.

backfill

(flag)
whether the new patients being added are from a backfill cohort.

cohort

(int)
if provided, the new patients will be assigned to this cohort index. If NULL (default), the cohort index will be determined based on the new_cohort parameter.

...

not used.

Details

The current implementation of this update method allows for updating the Data class object by adding a single dose level x only. However, there might be some use cases where the new cohort to be added contains a placebo and active dose. Hence, such update would need to be performed iteratively by calling the update method twice. For example, in the first call a user can add a placebo, and then in the second call, an active dose. Since having a cohort with placebo only is not allowed, the update method would normally throw the error when attempting to add a placebo in the first call. To allow for such updates, the check parameter should be then set to FALSE for that first call.

Examples

Run this code
# Create some data of class 'Data'.
my_data <- Data(
  x = c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
  y = c(0, 0, 0, 0, 0, 0, 1, 0),
  doseGrid = c(0.1, 0.5, 1.5, 3, 6, seq(from = 10, to = 80, by = 2))
)

# Update the data with a new cohort.
my_data1 <- update(my_data, x = 20, y = c(0L, 1L, 1L))
my_data1

Run the code above in your browser using DataLab