- use_pattern
A character string showing the daily, by visit, or weekly
substance use pattern for a single subject
- match_is
A single character value of the use indicator of interest;
e.g. "+" is use positive or "-" is use negative.
- start
These two arguments give the integer range wherein to look for
the use sub-pattern of interest. Usually, start should be the week of
randomization. Defaults to 1.
- end
The end of the detection range. This is often the end of followup
(denoted by -1, the default value, which represents the last item in the
string), or this could be a set number of weeks or visits, such as 12 weeks
or 48 visits.
- mixed_results_are
A single character value indicating a partial use
week; e.g. "*" means that the subject had at least one positive and
at least one negative test of the substance(s) of interest for that week.
Defaults to NULL.
- mixed_weight
A fraction showing the proportional use value for a
mixed result week. For example, some studies state that a positive UDS
counts as three days of use (3/7), while other studies regard a positive
UDS as five days of use (5/7). This value should be substance-specific,
but we default to 0.5.
- proportion
Should this function return the count or proportion of
matching use periods? Defaults to FALSE, signifying that the count
of matches will be returned. Note that if the remaining string (after
trimming to the values of start and end) has length 0, then
this function will return 0 rather than NaN (0/0). When interpreting this
value, 0 represents that the subject had no use periods matching the chosen
outcome.