将危害比率值(和置信区间)移到metafor包中的forest()中

时间:2019-08-30 17:15:24

标签: r forestplot metafor

我只是想将危害比/结果列及其相应的CI值移到左侧,以便可以在结果列的右侧添加p值,这可能吗?

在森林()的R文档中是否有一种简单的方法来查找此参数以及其他类似参数?


#Forest Plot
label1 <- as.character(c("<50", "50 to <60", "60"))
label1 <- factor(label1, levels = unique(label1))
hazards1 <- c(1.42, 1.66, 2.85)
lower1 <- c(1.34, 1.50, 2.59)
upper1 <- c(1.51, 1.85, 3.13)
patient_num1 <- c(240000, 180000, 220000)
event_num1 <- c(2600, 1300, 2900)
forestplot1 <- data.frame(label1, hazards1, lower1, upper1, event_num1, patient_num1)
forestplot1$patient_num1 <- rev(forestplot1$patient_num1)

par(mar=c(4,4,1,2))
pdf(file = "figureex.pdf", width = 15, height = 8.5)
pdf.options(encoding='ISOLatin2.enc')
forest(rev(hazards1), ci.lb = rev(lower1), ci.ub = rev(upper1), slab = rev(label1), xlim = c(-4,0), 
       xlab = "Adjusted Hazard Ratio for Event", 
       refline = 1, annotate = T, ylim = c(-1, 29), ilab = cbind(forestplot1$patient_num1, rev(event_num1)),
       ilab.xpos=c(-1,-0.25), at = c(0.25, 0.5, 1, 2, 4, 6), rows = c(1:3),
       cex = 1, yaxs = "i")
text(-4, 27.29, pos = 4, "Variable")
text(-1.25, 27.67, pos = 4, "No. of \nPatients")
text(-0.45, 27.67, pos = 4, "No. of \nEvents")
text(5.05, 27.69, pos = 4, "Hazard Ratio \n(95% CI)")
dev.off()


0 个答案:

没有答案