View source: R/scores_su_sui_tlfb.R
tlfb_substances | R Documentation |
Computes the length of abstinence in 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; and/or only binge use.
tlfb_substances
compute_tlfb_abst(
data,
name,
substance = NULL,
period = NULL,
days = 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: |
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: |
tlfb_substances
is a character vector of all substances that can be
reported in the TLFB.
A tibble with the computed score for each participant/event.
## Not run:
compute_tlfb_abst(
data = data_tlfb,
name = "su_y_tlfb__alc__cum_abst",
substance = "Alcohol"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.