We’re going to practice doing a meta-analysis in R. First, let’s load the necessary packages.

## checking if packages are installed, if they aren't, installing them 
## loading them after

if(!require(tidyverse)){
        install.packages("tidyverse")
}
library(tidyverse)

if(!require(meta)){
        install.packages("meta")
}
library(meta)

if(!require(readxl)){
        install.packages("readxl")
}
library(readxl)

if(!require(googlesheets4)){
        install.packages("googlesheets4")
}
library(googlesheets4)

We’re going to read the extracted data from the studies directly from googlesheets. Two outcomes will have their results summarized in this analysis, one dichotomous and one continuous.

## checking if the data has been read already, if it hasn't reading it
## from googlesheets directly

if(!exists("df", envir = .GlobalEnv, inherits = FALSE)){
        df <- read_sheet("https://docs.google.com/spreadsheets/d/12mRnNd5HrbpE54d0fL_AtFnlum86g8X5k8MoZRtc92w/")
}

## reading the dataset for continuous outcome
if(!exists("df1", envir = .GlobalEnv, inherits = FALSE)){
        df1 <- read_sheet("https://docs.google.com/spreadsheets/d/1wjJVGk-KobXbmKuhFDC0TIBaRLgIEO9-pV0zDmqQQQ4/")
}

Let’s take a look at the data:

head(df)
## # A tibble: 5 × 5
##   estudo                 evtto  ntto evcont ncont
##   <chr>                  <dbl> <dbl>  <dbl> <dbl>
## 1 Batagello                  3    93      6    96
## 2 Iskakov 2016               5    82     12    82
## 3 Kuma 2013                  6   100     24   100
## 4 Mohammadi Sichani 2019     1    64      2    66
## 5 Rashi 2018                 2    25      4    25
head(df1)
## # A tibble: 3 × 7
##   study            n.e mean.e  sd.e   n.c mean.c  sd.c
##   <chr>          <dbl>  <dbl> <dbl> <dbl>  <dbl> <dbl>
## 1 Batagello 2021    93   3.63  1.65    96   4.08  2   
## 2 Iskakov 2016      82   9.14  0.3     82  10.1   0.5 
## 3 Kumar 2013       100   2.74  1.06   100   4.67  3.08

Now, creating the variables for both meta-analyses, the binary and the continuous.

## meta-analysis variable for the binary outcome, mantel haenszel method
## reporting Relative risk
test1 <- metabin(evtto, ntto, evcont, ncont, estudo, data = df, sm = "RR", method = "MH")

## creating a meta-analysis variable for the continous variable, reporting 
## Standard Mean Differences (Hedges's g is the default)

test2 <- metacont (n.e, mean.e, sd.e, n.c, mean.c, sd.c, study, data = df1,
                   sm = "SMD")

With these variables we can create forest plots. One for each analysis:

test1 %>% forest(random = TRUE, common = FALSE, label.c = "Placebo",
                 label.right = "Favours Placebo", label.left = "Favours TXA",
                 label.e = "TXA", sortvar = 1/w.random)

test2 %>% forest (sortvar = 1/w.random, common = FALSE, random = TRUE,
                  label.e = "TXA", label.c = "Placebo",
                  label.right = "Favours Placebo", label.left = "Favours TXA")

In both cases, TXA was better than placebo.