gforge / forestplot

Advanced forest plots in R using grid graphics
44 stars 15 forks source link

Error when drawing multiple bands per row #69

Open YutingHan317 opened 1 week ago

YutingHan317 commented 1 week ago

Hi, I am trying to draw multiple bands per row. And I have made the label texts the same across the two groups. For the database, please take a look at the attachments. To draw the plot, I used my old codes (see below), which were written 1-2 years ago and were completely functional. However, an error appeared this time. Subtype-male-model1-1th.csv

Error in forestplot.grouped_df(., labeltext = c(V1, V5, V6), mean = V2, : There are seem be invalid the labels: Continuous > 2.27 (1.72-3.00) > 1.48 (1.23-1.77), Continuous > 2.27 (1.72-3.00) > 1.48 (1.23-1.77) appear in the wrong position.

The codes are as follows.

library(dplyr)
library(forestplot)
library(ggplot2)
library(magrittr)
library(data.table)

sub_male_m1_1th <- fread("Subtype-male-model1-1th.csv")

colnames(sub_male_m1_1th) <- paste0("V", seq_len(ncol(sub_male_m1_1th)))

sub_male_m1_1th %>%
group_by(V8) %>% 
  forestplot(labeltext = c(V1, V5, V6),
             mean = V2, lower = V3, upper = V4)

R-version: 4.3.2 and the Package version: 3.1.3&3.1.5(I've tried both).

And when I removed the rows with NA, the codes worked. But I need those rows.

Thank you for any help you can give me!

Best wishes,

Yuting