Skip to content

Commit

Permalink
Better fix for the chunks that require R 4.4.0 or later
Browse files Browse the repository at this point in the history
  • Loading branch information
remlapmot committed Sep 25, 2024
1 parent 10669d7 commit 0567d0b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vignettes/perform_mr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ vignette: >
---

```{r, include=FALSE}
evalinr44 <- getRversion() >= '4.4.0'
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
Expand Down Expand Up @@ -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
Expand All @@ -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)
```
Expand Down

0 comments on commit 0567d0b

Please sign in to comment.