View source: R/scores_su_sui_tlfb.R
compute_tlfb_ud | R Documentation |
Computes the number of use days for a given (set of) substance(s). Optionally, allows to filter by period (detailed and/or estimated); only considering a specified number of days before the TLFB interview; only considering specific day types (weekends or week days); only considering days with co-use of (a)other substance(s); and/or only binge use.
compute_tlfb_ud(
data,
name,
substance = NULL,
period = NULL,
days = NULL,
wknd = NULL,
co_use = NULL,
binge = NULL
)
data |
tibble. A data frame containing the TLFB raw data. |
name |
character. The name of the output column for the computed score. |
substance |
character (vector). The substance(s) to compute the score for. Must be one or several of the following values:
(Default: |
period |
character (vector). The period for which the score is
computed for. Must be one of |
days |
integer. Number of days before the TLFB interview to consider.
(Default: |
wknd |
logical. Whether the score should be computed for weekends only
( |
co_use |
character (vector). Co-use substance(s). Must be one or several
of the possible values for |
binge |
(named list of) numeric. Binge threshold(s) for the
substance(s). If only one value is provided, it is used, independent of the
sex of the participant. If a list is provided, it must contain two named
elements: |
A tibble with the computed score for each participant/event.
## Not run:
compute_tlfb_ud(
data = data_tlfb,
name = "su_y_tlfb__alc__1mo__wknd_ud",
substance = "Alcohol",
days = 30,
wknd = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.