尝试创建Forest Plot时出现R代码错误

时间:2021-07-20 21:53:20

I am using the following code in R to build a Forest Plot:

我在R中使用以下代码来构建Forest Plot:

library(forestplot)

    cochrane_from_rmeta <-
  structure(list(
    mean  = c(NA, NA, 1.62, 1.48, 1.43, 1.55, 1.60, 1.63, 1.48, 1.43, 1.43, 1.41, NA),
    lower = c(NA, NA, 1.23, 0.95, 1.04, 1.15, 1.01, 1.83, 1.15, 1.04, 1.07, 0.79, NA),
    upper = c(NA, NA, 2.14, 2.31, 1.95, 2.09, 2.53, 5.68, 1.91, 1.95, 1.92, 2.54, NA)),
    .Names = c("mean", "lower", "upper"),
    row.names = c(NA, -13L),
    class = "data.frame")

    tabletext<-cbind(
  c("", "Subgroup", "RRMS", "<40 years-old",
    "≥ 40 years-old", "Female", "Male", "First-Line",
    "Non First-Line", "Baseline GdE Lesions","No Baseline GdE Lesions",
    "Direct Switch from NTZ", NA),
  c("Discontinuation", "(DMF)", "244", "93",
    "233", "238", "88", "27",
    "299", "63", "240","41", NA),
  c("Discontinuation", "(FTY)", "148", "62",
    "124", "137", "49", "7",
    "179", "32","138","57", NA),
  c("", "OR", "1.62", "1.48",
    "1.43", "1.55", "1.60", "1.63",
    "1.48", "1.43", "1.43", "1.41", NA))

    forestplot(tabletext,
           cochrane_from_rmeta,new_page = TRUE,
           is.summary=c(TRUE,TRUE,rep(FALSE,10),TRUE),
           clip=c(0.1,2.5),
           xlog=TRUE,
           col=fpColors(box="royalblue",line="darkblue", summary="royalblue"))

When I do this, I get the following error:

当我这样做时,我收到以下错误:

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

Any ideas on how to adjust my code so that the error is fixed?

有关如何调整我的代码以便修复错误的任何想法?

Thanks in advance, Carrie

提前谢谢,嘉莉

1 个解决方案

#1


0  

You need to specify the mean, lower and upper parameters

您需要指定mean,lower和upper参数

    forestplot(tabletext,
                   cochrane_from_rmeta$mean,
                   cochrane_from_rmeta$lower,
                   cochrane_from_rmeta$upper,
                   new_page = TRUE,
                   is.summary=c(TRUE,TRUE,rep(FALSE,10),TRUE),
                   clip=c(0.1,2.5),
                   xlog=TRUE,
                   col=fpColors(box="royalblue",line="darkblue", summary="royalblue"))

尝试创建Forest Plot时出现R代码错误

#1


0  

You need to specify the mean, lower and upper parameters

您需要指定mean,lower和upper参数

    forestplot(tabletext,
                   cochrane_from_rmeta$mean,
                   cochrane_from_rmeta$lower,
                   cochrane_from_rmeta$upper,
                   new_page = TRUE,
                   is.summary=c(TRUE,TRUE,rep(FALSE,10),TRUE),
                   clip=c(0.1,2.5),
                   xlog=TRUE,
                   col=fpColors(box="royalblue",line="darkblue", summary="royalblue"))

尝试创建Forest Plot时出现R代码错误