Significant figures for mean and sds in forest plot for metafor

612 Views Asked by At

I created a forest plot using metafor. The data I downloaded all has two significant figures after the decimal point for the study means and SDs, but when it uploads to the forest plot, these trailing zeros are dropped.

How can I keep these trailing zeros to make it look better?

The code for the forest plot is:

forest(meta2, showweights = TRUE, ilab.xpos=c(-24.5,-22, -19.5, -16, -13.75, -11),
       ilab=cbind(bmi_awm$Intervention_n, bmi_awm$Intervention_mean, bmi_awm$Intervention_SD, bmi_awm$Comparison_n, bmi_awm$Comparison_mean, bmi_awm$Comparison_SD),(digits=2),
       ilab.pos = 4,
       rows=c(48), ylim=c(-1, 51.5), xlim=c(-35.5, 14), at=(c(-7, 0, 7))

enter image description here

1

There are 1 best solutions below

3
Wolfgang On

See the documentation of the forest() function:

https://wviechtb.github.io/metafor/reference/forest.rma.html

digits: integer to specify the number of decimal places to which the tick mark labels of the x-axis and the annotations should be rounded (the default is 2L). Can also be a vector of two integers, the first to specify the number of decimal places for the annotations, the second for the x-axis labels. When specifying an integer (e.g., 2L), trailing zeros after the decimal mark are dropped for the x-axis labels. When specifying a numeric value (e.g., 2), trailing zeros are retained.

The problem in your code is that you have digits=2 wrapped in parentheses. Get rid of those and the training zeros should be retained.