Create a class of arm.
Public methods in this R6 class are used in developing this package. Thus, we have to export the whole R6 class which exposures all public methods. However, only the public methods in the list below are useful to end users.
$add_endpoints()
$print()
Methods
Method new()
initialize an arm
Usage
Arms$new(name, ...)
Arguments
name
name of arm, which is the arm's label in generated data
...
subset condition that is compatible with
dplyr::filter
. This can be used to specify inclusion criteria of an arm. By default it is not specified, i.e. all data generated by the generator will be used as trial data. More than one conditions can be specified in...
.
Method add_endpoints()
add one or multiple endpoints to the arm.
Arguments
...
one or more objects returned from
endpoint()
.
Examples
a <- arm(name = 'trt')
x <- endpoint(name = 'x', type = 'tte',
generator = rexp) # median = log(2)/1 = 0.7
y <- endpoint(name = 'y', type = 'non-tte', readout = c(y = 0),
generator = rnorm, sd = 1.4, mean = 0.7)
a$add_endpoints(y, x)
## run it in console to see the summary report
a
print(a) # use the print method
Method update_endpoint_generator()
update generator of an endpoint object
Arguments
endpoint_name
character. A vector of endpoint names whose generator is updated.
generator
a random number generation (RNG) function. See
generator
ofendpoint()
....
optional arguments for
generator
.
Method print()
print an arm.
Examples
# Instead of using Arms$new(), please use arm(), a user-friendly
# wrapper. See examples in ?arm
## ------------------------------------------------
## Method `Arms$add_endpoints`
## ------------------------------------------------
a <- arm(name = 'trt')
x <- endpoint(name = 'x', type = 'tte',
generator = rexp) # median = log(2)/1 = 0.7
y <- endpoint(name = 'y', type = 'non-tte', readout = c(y = 0),
generator = rnorm, sd = 1.4, mean = 0.7)
a$add_endpoints(y, x)
## run it in console to see the summary report
a
#> Summary generated.
print(a) # use the print method
#> Summary generated.