| harmonize_mr_data | R Documentation |
Takes a data frame that already contains all required MR columns, aligns
outcome alleles to the exposure strand (Step 1), then standardizes the sign
of beta_exposure (Step 2). Returns both a full working data frame
(check_df) and a slim, renamed input data frame (input_df),
mirroring the output of format_mr_input().
harmonize_mr_data(
df,
Outcome = NULL,
Exposure = NULL,
beta_sign = c("positive", "negative")
)
df |
Data frame containing required columns: |
Outcome |
Optional; character string to set as the Outcome name when
the column is absent from |
Exposure |
Optional; character string to set as the Exposure name when
the column is absent from |
beta_sign |
Character string controlling the target sign for
|
A named list with two elements:
check_dfFull working data frame retaining all allele columns after harmonization. Useful for quality-checking results.
input_dfSlim data frame ready for MR analysis, with columns: Instrument, beta_exposure, se_exposure, beta_outcome, se_outcome, Outcome, Exposure, ALLELE1, ALLELE0, A1FREQ.
result1 <- harmonize_mr_data(df = fi_49item)
head(result1$check_df)
head(result1$input_df)
# Force all exposure betas to be negative
result2 <- harmonize_mr_data(df = fi_49item, beta_sign = "negative")
head(result2$input_df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.