From 0567d0bf2ed4732b392b5ca6ed08ac4f91459aae Mon Sep 17 00:00:00 2001 From: Tom Palmer Date: Wed, 25 Sep 2024 07:55:52 +0100 Subject: [PATCH] Better fix for the chunks that require R 4.4.0 or later --- vignettes/perform_mr.Rmd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vignettes/perform_mr.Rmd b/vignettes/perform_mr.Rmd index 46ee8390..b9bfd348 100644 --- a/vignettes/perform_mr.Rmd +++ b/vignettes/perform_mr.Rmd @@ -13,6 +13,7 @@ vignette: > --- ```{r, include=FALSE} +evalinr44 <- getRversion() >= '4.4.0' knitr::opts_chunk$set( collapse = TRUE, comment = "#>", @@ -633,7 +634,7 @@ ld_mat Here `ld_matrix()` returns the LD correlation values (not R^2^) for each pair of variants present in the 1000 genomes data set. -```{r eval=FALSE} +```{r} dat <- harmonise_data( exposure_dat = bmi_exp_dat, outcome_dat = chd_out_dat @@ -642,19 +643,19 @@ dat <- harmonise_data( Convert to the `MRInput` format for the MendelianRandomization package: -```{r eval=FALSE} +```{r eval=evalinr44} dat2 <- dat_to_MRInput(dat) ``` This produces a list of `MRInput` objects that can be used with the MendelianRandomization functions, e.g. -```{r eval=FALSE} +```{r eval=evalinr44} MendelianRandomization::mr_ivw(dat2[[1]]) ``` Alternatively, convert to the `MRInput` format but also obtaining the LD matrix for the instruments -```{r eval=FALSE} +```{r eval=evalinr44} dat2 <- dat_to_MRInput(dat, get_correlation = TRUE) MendelianRandomization::mr_ivw(dat2[[1]], correl = TRUE) ```