View source: R/scores_su_sui_tlfb.R
filter_tlfb | R Documentation |
This function filters the TLFB (Timeline Followback) data based on specified substance(s); period (estimated vs. detailed); number of days before the TLFB interview; weekend-only usage; co-use of other substances; and/or binge use.
filter_tlfb(
data,
substance = NULL,
period = NULL,
days = NULL,
wknd = NULL,
co_use = NULL,
binge = NULL
)
data |
tibble. A data frame containing the TLFB raw data. |
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 filtered data frame based on the specified criteria.
## Not run:
filtered_data <- filter_tlfb(
data,
substance = "Alcohol",
wknd_only = TRUE,
period = "estimated",
days = 30
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.