Generic function to add columns
add_var.RdGeneric function to add columns
Usage
add_var(
  data,
  stcs,
  .var,
  from = detect_from(stcs, .var),
  by = detect_by(stcs, .var, from),
  .filter
)
expand_var_from(data, stcs, .var, from, by, .filter)
new_var_from(data, stcs, .var, from, by, .filter, relationship)Arguments
- data
- A data frame with a STCS key ( - by).
- stcs
- A list containing the STCS data frame. 
- .var
- chr. The name of variables to add. It can be a named vector (to rename) of length >1. 
- from
- chr. The name of a dataset in the stcs object 
- by
- chr. A named vector used the matching. Argument passed to - left_join.- names(by)matches variable in data and- bymatches variable in- stcs$from.
- .filter
- an optional argument which can be use to filter - stcs$frombefore matching.
- relationship
- chr. Argument passed to - left_join.
Examples
if (FALSE) { # \dontrun{
stcs <- stcs_read("path/to/stcs/dataset/")
data_patientkey(stcs) |>
   add_var(stcs,"sex")
data_patientkey(stcs) |>
  expand_var_from(stcs,"patlongkey",from="patientlongitudinal","patientkey") |>
  add_var(stcs,"bmi")
} # }