View source: R/scores_su_sui_tlfb.R
compute_tlfb_dt | R Documentation |
Computes either the first or last date of use 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 days with co-use of (a)other substance(s); and/or only binge use.
compute_tlfb_dt(
data,
name,
substance = NULL,
period = NULL,
days = NULL,
co_use = NULL,
binge = NULL,
position
)
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: |
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: |
position |
character. The position of the substance use event. Must be
one of |
A tibble with the computed score for each participant/event.
compute_tlfb_abst()
## Not run:
compute_tlfb_dt(
data = data_tlfb,
name = "su_y_tlfb__alc__first__cum_dt",
substance = "Alcohol",
position = "first"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.