col and row names in a Forest plot

Viewed 1256

I don't how to introduce columns and rows names into a forest plot. Here is the dataset:

structure(list(structure(c(5L, 6L, 4L, 3L, 2L, 1L), .Label = c("Austria", 
"Denmark", "England", "France", "Portugal", "Spain"), class = "factor"), 
Slope = c(-1.8511, -2.33305, -2.698, -1.46, -0.98, -1.401
), low = c(-3.3021, -4.305, -5.873, -4.86, -5.082, -2.887
), high = c(-0.4008, -0.364, -0.087, 2.98, 3.125, -0.054), 
bS0 = c(-5.66, -2.709, -4.057, -1.224, -0.574, -1.43), Sf = c(0.354, 
0.169, 0.253, 0.077, 0.036, 0.089), `S0-Sf` = c(0.146, 0.126, 
0.169, 0.091, 0.061, 0.088)), .Names = c("", "Slope", "low", 
"high", "bS0", "Sf", "S0-Sf"), class = "data.frame", row.names = c(NA, 
-6L))

And here the script to get the Forest plot:

windows()
forestplot(labeltext=data, graph.pos=3, 
       mean=c(data$Slope), 
       lower=c(data$low), upper=c(data$high),
       xlab="Regression Coefficient",
       txt_gp=fpTxtGp(label=gpar(cex=1),
                      ticks=gpar(cex=1),
                      xlab=gpar(cex = 1),
                      title=gpar(cex = 1)),
       col=fpColors(box="black", lines="black", zero = "gray50"),
       zero=0, cex=0.9, lineheight = "auto", boxsize=0.1,
       lwd.ci=1, ci.vertices=TRUE, ci.vertices.height = 0.1,colgap=unit(4,"mm"))

And here is the outcome: enter image description here

However, I would like to introduce the names of the countries (column 1 of my data) and the columns names. How should I do it?

2 Answers

You need to use graph.pos argument inside the forestplot function.

For example, use graph.position=3 if you want the plot after the slope column

Related