1 | initial version |
To incorporate superscripts in a forest.meta plot, you can follow these steps:
metaforest
function from the meta
package to create the forest plot.text
argument, include the variable for the superscript text using the bquote
function to format it as superscript.plot.ci=TRUE
argument to display the confidence intervals on the plot.metaforest
arguments and ggplot2
functions.Here is an example code that incorporates superscripts in a forest.meta plot using the mtcars
dataset:
```{r} library(meta)
df <- data.frame( Study = rownames(mtcars), Estimate = mtcars$mpg, Lower = mtcars$mpg - 3, Upper = mtcars$mpg + 3, Treat = ifelse(mtcars$am == 0, "Manual", "Automatic"), Text = ifelse(mtcars$gear == 3, "3^rd", "") )
metaforest( df$Estimate, df$Lower, df$Upper, study = df$Study, xlab = "Miles Per Gallon", ilab = paste(df$Treat, "Transmission"), text = bquote(italic("Gear: "), .(df$Text)), plot.ci = TRUE, col = c("#1b9e77", "#d95f02"), xlim = c(10, 40), cex.axis = 1.2, cex.lab = 1.5 ) ```
This will create a forest.meta plot with superscripts for the "Gear" variable, indicating the third gear in each study's manual transmission.