#THIS IS AN R CODE SCRIPT library(rstudioapi) library(readxl) library(meta) # Select Excel file filepath <- "E:/SAVE R FILES HERE/Meta-analysis/Pip-tazo vs Cefepime/Extracted data.xlsx" # Read sheets sheetsnames <- excel_sheets(filepath) ma <- lapply(sheetsnames, function(x) { as.data.frame(read_excel(filepath, sheet = x)) }) names(ma) <- sheetsnames # Use your continuous dataset data <- ma$Duration_of_treatment # Run meta-analysis (FIXED column names) m.cont <- metacont( n.e = n_interv, mean.e = mean_interv, sd.e = sd_interv, n.c = n_ctrl, mean.c = mean_ctrl, sd.c = sd_ctrl, data = data, studlab = Authors, sm = "MD", method.tau = "REML", method.random.ci = "classic", random = TRUE, common = FALSE, prediction = FALSE ) summary(m.cont) png( filename = "E:/SAVE R FILES HERE/Meta-analysis/Pip-tazo vs Cefepime/SUCCESS FOREST PLOT.png", width = 5000, # wide enough for long study names height = 1500, res = 300 ) forest(m.cont, layout = "Revman", random = T, common = F, test.overall.random = T, pooled.events = T, label.e = "Pip-Tazo", label.c = "Cefepime", label.left = "Favors Pip-Tazo", label.right = "Favors Cefepime", leftcols = c("studlab", "mean.e","sd.e","n.e", "mean.c","sd.c","n.c", "w.random", "effect","ci"), leftlabs = c("Study", NA, NA,NA, NA, NA,NA, "Weight (%)", "Effect size", "95% CI"), xlim = c(-5, 6), ff.xlab = "bold", col.square = "darkblue", col.square.lines = "black", col.diamond.random = "white", col.diamond.lines.random = "black", colgap = "5mm", colgap.studlab = "10mm", colgap.forest.left = "5mm", just = "center", digits = 1, digits.mean = 1, digits.sd = 1, digits.pval = 1) dev.off()