Skip to content

Instantly share code, notes, and snippets.

@n8thangreen
Last active December 15, 2016 09:54
Show Gist options
  • Select an option

  • Save n8thangreen/efa60a48a7d93a7baef4 to your computer and use it in GitHub Desktop.

Select an option

Save n8thangreen/efa60a48a7d93a7baef4 to your computer and use it in GitHub Desktop.
forest plot horizontal lines grouped
library("rmeta", lib.loc="C:/Program Files/R/R-3.1.0/library")
names <- c("Premature", "Not premature",
NA,"Surgical","Not surgical",
NA,"Congenital","Not congenital",
NA,"Catheter","Not catheter",
NA,"Other","Not other",
NA,"Tai","Not Tai",
NA,"Cancer","Not cancer")
tabletext <- cbind(c("","Risk factor",names,NA,"All-cause with ICD10 infection","All-cause without ICD10 infection"))
m <- c(NA,NA,1.11,3.01,
NA,-4.45,4.8,
NA,10.52,2.24,
NA,5.53,4.15,
NA,9.78,3.96,
NA,2.3,4.67,
NA,-2.11,5.24,
NA,1.57,4.68,NA)
l <- c(NA,NA,-12.71,-1.22,
NA,-9.63,1.04,
NA,-7.27,-1.79,
NA,-2.54,0.65,
NA,-0.36,-1.25,
NA,-6.96,2.21,
NA,-6.48,1.53,
NA,0.2,0.54,NA)
u <- c(NA,NA,14.93,7.25,
NA,0.74,8.56,
NA,28.31,6.27,
NA,13.59,7.65,
NA,19.93,9.17,
NA,11.57,7.14,
NA,2.25,8.96,
NA,2.95,8.83,NA)
forestplot(tabletext,m,l,u,zero=0, xlog=F, boxsize=0.75,
col=meta.colors(box="royalblue",line="darkblue", summary="royalblue"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment