Upper/lower boundaries error while generating forest plot

I am trying to generate a forest plot using the following sample data and code:

structure(list(Variable = c(NA, "Continuous", "Cell 1", " ", 
" ", " ", NA, "Cell 2", NA, NA, NA, NA, "Cell 3", NA, NA, NA, 
NA, "Cell 3", NA, NA, NA, NA), Type = c(NA, NA, "Type 1", "Type 2", 
"Type 3", "Type 4", "Other", "Type 1", "Type 2", "Type 3", "Type 4", 
"Other", "Type 1", "Type 2", "Type 3", "Type 4", "Other", "Type 1", 
"Type 2", "Type 3", "Type 4", "Other"), OR..95.CI. = c(NA, NA, 
"5.60e+230 (0.00e+00 -Inf)", "NA ", "1.76e+04 (0.00e+00 -1.75e+11)", 
"3.59e+01 (3.10e-01 -4.13e+03)", "1.21e+01 (4.00e-02 -3.83e+03)", 
"8.39e+12 (4.03e-18 -1.75e+43)", "NA ", "1.75e+00 (0.00e+00 -2.09e+03)", 
"3.08e+01 (1.00e-01 -1.19e+03)", "5.06e+04 (1.00e-02 -2.54e+11)", 
"Inf (0.00e+00 -Inf)", "NA ", "9.00e+02 (0.00e+00 -5.40e+09)", 
"1.31e+01 (1.80e-01 -9.74e+02)", "34.90e-01 (0.00e+00 -4.62e+02)", 
"3.44e+01 (6.00e-02 -1.82e+04)", "NA ", "2.24e+01 (0.00e+00 -1.90e+05)", 
"1.23e+01 (1.40e-01 -1.04e+03)", "6.22e+09 (3.51e-05 -2.96e+23)"
), p.value = c(NA, NA, "1", "  NA", "0.23", "0.14", "0.4", "0.4", 
"  NA", "0.88", "0.32", "0.17", "1", "  NA", "0.39", "0.24", 
"0.84", "0.27", "  NA", "0.5", "0.27", "0.18"), FDR = c(NA, NA, 
"1", "  NA", "0.67", "0.32", "0.53", "0.81", "  NA", "0.88", 
"0.32", "0.36", "1", "  NA", "0.67", "0.32", "0.84", "0.81", 
"  NA", "0.67", "0.32", "0.36")), class = "data.frame", row.names = c(NA, 
-22L))

###### Load data and packages

Table <- read.csv("~/Desktop/Table.csv", stringsAsFactors = , na.strings = c("N/A", ""))

pacman::p_load(pacman, party, rio, tidyverse) 
library(scales)

Forest_lines <- Table[,c(3:5)] 
Forest_lines <- rbind(c(NA,NA,NA), c(NA,NA,NA), Forest_lines[c(3:22),])


###Graphing the forest plot:

library(forestplot)

png("~/Desktop/Test.png", width = 1200, height = 800)
forestplot(Table,
           Forest_lines,
           new_page = T,
           is.summary=c(rep(FALSE, 22)),   
           clip=c(0.01,50),
           xlog=T,
           col=fpColors(box="royalblue",line="darkblue", summary="royalblue"),
           graph.pos = 3,
           boxsize = 0.3,
           xticks = c(0.01, 0.1, 0.5, 1, 2, 10, 90),
           xlab = "
Decreased X           Increased X",
           txt_gp = fpTxtGp(label = gpar(fontfamily = "", cex=.95), ticks = gpar(cex=1.1), xlab  = gpar(cex = 1.1)),
           title = "XYZ")
dev.off()

However, I am getting the following error:

"Error in prFpConvertMultidimArray(mean) : 
  Sorry did not manage to correctly identify the upper/lower boundaries from the input matrix."

Is there a way to resolve this? Also, is it possible to change the colour of boxes in the forest plot manually (e.g. Type 1 boxes designated with a red colour, Type 2 with blue, etc).

Thanks!

a forest plot requires a value and some bounds (upper and lower) to plot.
Exactly what in your data 'forest_lines' represents these 3 aspects?. I wonder if you intend OR..95.CI. information to be used ? You will need to wrangle it a lot .
How did you come by this information? if it was via your own analysis, perhaps we should go back to that, as I would guess you could have kept things 'cleaner'

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.