library(chmsflow)The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
library(chmsflow)There are two types of derived variables in the CHMS surveys. Both are supported in chmsflow.
chmsflow computes derived variables using functions referenced in variable-details.csv. The recEnd column uses the prefix Func:: to name the R function, and the variableStart column uses the prefix DerivedVar:: to list the input variables.
For example, GFR (gfr_ml_min) has:
recEnd: Func::calculate_gfrvariableStart: DerivedVar::[lab_bcre, pgdcgt, clc_sex, clc_age]This tells rec_with_table() to call calculate_gfr() with the four input variables.
Since derived variables depend on their input variables, you must list both the derived variable and its inputs when calling rec_with_table():
cycle2_gfr <- recodeflow::rec_with_table(
cycle2,
variables = c("lab_bcre", "pgdcgt", "clc_sex", "clc_age", "gfr_ml_min"),
variable_details = variable_details,
log = TRUE
)For variables that depend on medication status (e.g., hypertension, diabetes), use recode_after_meds() instead of rec_with_table(). See Recoding medications and Analysis walkthrough for the full workflow.
To add a new derived variable to chmsflow, you need to create a harmonized set of input variables and an R function that computes the derived value. See How to add variables for step-by-step instructions.
For details on the metadata schema, see Variable schema reference.
tagged_na() codes propagate through derived variable functions in Missing data (tagged_na).These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.