# Define the data as a string
data <- "
Study_ID\tsample\tAdv_Post_op\tAdv_12_mon\tAdv_long\tsubgroup
Christmas 2010\t20\t19\t15\t105\tsurgery
Subramanina 2016\t45\t26\t4\t0\tsurgery
Josue 2019\t10\t10\t8\tNA\tsurgery
Bergfeld 2016\t25\t14\tNA\tNA\tstimulation
Malone 2008\t15\t3\tNA\tNA\tstimulation
Dougherty 2014\t16\t7\tNA\tNA\tstimulation
"

# Read the data into a dataframe
adv <- read.table(text = data, header = TRUE, sep = "\t", na.strings = "NA")

# View the dataframe
print(adv)
##           Study_ID sample Adv_Post_op Adv_12_mon Adv_long    subgroup
## 1   Christmas 2010     20          19         15      105     surgery
## 2 Subramanina 2016     45          26          4        0     surgery
## 3       Josue 2019     10          10          8       NA     surgery
## 4    Bergfeld 2016     25          14         NA       NA stimulation
## 5      Malone 2008     15           3         NA       NA stimulation
## 6   Dougherty 2014     16           7         NA       NA stimulation
library(meta)
## Loading required package: metadat
## Loading 'meta' package (version 7.0-0).
## Type 'help(meta)' for a brief overview.
## Readers of 'Meta-Analysis with R (Use R!)' should install
## older version of 'meta' package: https://tinyurl.com/dt4y5drs
meta_analysis1 <- metaprop(event = Adv_Post_op, n = sample, data = adv, 
                          sm = "PLO", method.tau = "DL",
                          prediction = FALSE, comb.fixed = FALSE,
                          comb.random = TRUE, studlab = Study_ID,
                          byvar = subgroup
                          )


summary(meta_analysis1)
##                  proportion           95%-CI %W(random)    subgroup
## Christmas 2010       0.9500 [0.7513; 0.9987]       10.9     surgery
## Subramanina 2016     0.5778 [0.4215; 0.7234]       23.6     surgery
## Josue 2019           1.0000 [0.6915; 1.0000]        6.9     surgery
## Bergfeld 2016        0.5600 [0.3493; 0.7560]       21.8 stimulation
## Malone 2008          0.2000 [0.0433; 0.4809]       17.0 stimulation
## Dougherty 2014       0.4375 [0.1975; 0.7012]       19.8 stimulation
## 
## Number of studies: k = 6
## Number of observations: o = 131
## Number of events: e = 79
## 
##                      proportion           95%-CI
## Random effects model     0.5925 [0.3792; 0.7759]
## 
## Quantifying heterogeneity:
##  tau^2 = 0.7375 [0.3196; 12.2732]; tau = 0.8588 [0.5653; 3.5033]
##  I^2 = 72.2% [35.9%; 88.0%]; H = 1.90 [1.25; 2.88]
## 
## Test of heterogeneity:
##      Q d.f. p-value
##  18.01    5  0.0029
## 
## Results for subgroups (random effects model):
##                          k proportion           95%-CI  tau^2    tau    Q   I^2
## subgroup = surgery       3     0.8626 [0.4245; 0.9816] 2.6811 1.6374 8.97 77.7%
## subgroup = stimulation   3     0.4124 [0.2271; 0.6265] 0.3322 0.5764 4.58 56.3%
## 
## Test for subgroup differences (random effects model):
##                   Q d.f. p-value
## Between groups 3.45    1  0.0632
## 
## Details on meta-analytical method:
## - Inverse variance method
## - DerSimonian-Laird estimator for tau^2
## - Jackson method for confidence interval of tau^2 and tau
## - Logit transformation
## - Clopper-Pearson confidence interval for individual studies
## - Continuity correction of 0.5 in studies with zero cell frequencies
# To visualize the results, you can plot a forest plot
meta::forest(meta_analysis1, layout = "RevMan")

Adverse effects