View source: R/combine_current_and_past_observations.R
combine_current_and_past_observations | R Documentation |
This is a specialized function for use with LAVA Query data frames, and can be
thought of as a conditional version of spread()
or pivot_longer()
. There are
a number of questionnaires where data is collected about the "current" time
point and about a time in the "past," generally 5 years in the past for the
questionnaires we use. This "past" data is collected only once while the "current"
data is collected at initial and every subsequent visit. Ultimately, researchers
will want to calculate change scores from before someone's diagnosis, and this function
places the "past/before" data next to every instance of "current" data/
combine_current_and_past_observations( .data, CurrentPast = CurrentPast, DCDate = DCDate, PIDN = PIDN )
.data |
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). |
CurrentPast |
variable indicating whether the observation is a "Current" or "Past" record; default column name expected is CurrentPast, but can be replaced with any column with "current" and "past"/"before" characters |
DCDate |
date column; defaults to DCDate |
PIDN |
identifier column; defaults to PIDN |
dataframe
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.