is_dosing_period: Determine whether to dose during certain cycles.

Description Usage Arguments Details Value Examples

View source: R/convenience.R

Description

Determine whether to dose during certain cycles.

Usage

1
is_dosing_period(N, init, pattern, first, then_every, cap = Inf)

Arguments

N

cycles or periods to check.

init

Non-repeating dosing indicator at beginning.

pattern

Repeating dosing pattern after initial.

first

if init is not specified, how many periods at the beginning should be dosed. Must be non-negative.

then_every

if pattern is not specified, make it (then_every - 1) zeroes followed by a 1. If then_every has any negative value, there is no dosing after the initial period (equivalent to setting pattern = 0).

cap

largest dosing period

Details

init takes precedence over first; that is, if init is defined, then first is ignored. Similarly, pattern takes precedence over then_every.

Value

A logical vector indicating whether or not a patient is dosed during the relevant period (markov cycle).

Examples

1
2
3
4
5
6
7
8
  is_dosing_period(N = 1:13, first = 4, then_every = 3, cap = 40)
  is_dosing_period(N = 37:46, first = 4, then_every = 3, cap = 40)
  is_dosing_period(N = 1:100, init = c(1,0,1,0,1,0,1,1), pattern = c(1, 0, 1, 1, 0), cap = 120)
  ## stop after initial period
  is_dosing_period(N = 1:8, first = 4, pattern = 0, cap = 40)
  ## demonstrating argument precedence rules
  is_dosing_period(N = 1:10, init = c(1,0,1), first = 3, then_every = 5)
  is_dosing_period(N = 1:10, init = numeric(0), pattern = c(1, 1, 0, 1, 0), then_every = 2)

MattWiener/heemodFits documentation built on May 19, 2019, 8:21 a.m.