r - R包“forestplot”:错误消息re:从输入矩阵中识别上/下边界
问题描述
我会很感激你的帮助。我正在使用 forestplot R 包来创建森林图。进展顺利。
library(forestplot)
test_data <- data.frame(
coef = c(1.53, 1.56, 1.11, 1.35, 1.00, 0.94, 1.03),
low = c(1.43, 1.38, 1.08, 1.05, 0.91, 0.87, 0.95),
high = c(1.64, 1.76, 1.15, 1.75, 1.10, 1.01, 1.11),
boxsize = c(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
)
row_names <- cbind(
c("Variable", "BMI", "WHR", "Diabetes", "Insulin resistance", "LDL", "HDL", "ApoB"),
c("SNPs", "807", "368", "386", "53", "213", "510", "241"),
c("OR (95% CI)", "1·53 (1·43−1·64)", "1·56 (1·38−1·76)", "1·11 (1·08−1·15)", "1·35 (1·05−1·75)", "1·00 (0·91−1·10)", "0·94 (0·87−1·01)", "1·03 (0·95−1·11)"),
c("p-value", "6·72E−35", "2·90E−12", "6·61E−10", "0·02", "0·97", "0·083", "0·53")
)
test_data <- rbind(rep(NA, 3), test_data)
forestplot(
labeltext = row_names,
xlab = "Odds ratio",
test_data[, c("coef", "low", "high")],
is.summary = FALSE,
boxsize = test_data$boxsize,
zero = 1,
cex = 0.1,
align = TRUE,
xlog = FALSE,
graphwidth = unit(1.5, "snpc"),
col = fpColors(lines = "royalblue", box = "darkblue")
)
我一直在一次添加一个变量,并在添加每个变量后绘制我的图表,以确保每个步骤都没有引入错误。一切都很顺利,直到我添加了我的第八个变量“甘油三酯”及其相关数字:
library(forestplot)
test_data <- data.frame(
coef = c(1.53, 1.56, 1.11, 1.35, 1.00, 0.94, 1.03, 1.15),
low = c(1.43, 1.38, 1.08, 1.05, 0.91, 0.87, 0.95, 1.07),
high = c(1.64, 1.76, 1.15, 1.75, 1.10, 1.01, 1.11, 1.11),
boxsize = c(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
)
row_names <- cbind(
c("Variable", "BMI", "WHR", "Diabetes", "Insulin resistance", "LDL", "HDL", "ApoB", "Triglycerides"),
c("SNPs", "807", "368", "386", "53", "213", "510", "241", "427"),
c("OR (95% CI)", "1·53 (1·43−1·64)", "1·56 (1·38−1·76)", "1·11 (1·08−1·15)", "1·35 (1·05−1·75)", "1·00 (0·91−1·10)", "0·94 (0·87−1·01)", "1·03 (0·95−1·11)", "1·15 (1·07−1·11)"),
c("p-value", "6·72E−35", "2·90E−12", "6·61E−10", "0·02", "0·97", "0·083", "0·53", "2·14E−4")
)
test_data <- rbind(rep(NA, 3), test_data)
forestplot(
labeltext = row_names,
xlab = "Odds ratio",
test_data[, c("coef", "low", "high")],
is.summary = FALSE,
boxsize = test_data$boxsize,
zero = 1,
cex = 0.1,
align = TRUE,
xlog = FALSE,
graphwidth = unit(1.5, "snpc"),
col = fpColors(lines = "royalblue", box = "darkblue")
)
添加这第八个变量时,我现在收到以下错误消息:
prFpConvertMultidimArray(mean) 中的错误:抱歉,未能正确识别输入矩阵的上/下边界。
我在这里找不到语法错误,我真的不知道为什么这才刚刚发生。任何建议将不胜感激。
谢谢你。
解决方案
推荐阅读
- python - 与字典比较后有条件地填充列
- dns - Ethernet-to-I2C box not seen when VPN turned on
- node.js - 项目中的猫鼬聚合查找
- regex - Powershell替换cron计划中的第二项?
- android-gradle-plugin - How to configure external build per build variant?
- python - How do I change the same string within a column and make it permanent using Pandas
- flutter - 正确的凭证数据后颤振自动填充触发器
- node.js - 当我使用地理编码器时,我的中间件不起作用
- maven - cxf-xjc-plugin maven 错误“懦弱地拒绝写入不存在的目录“src\main\java””
- java - 是否可以在 ControllerAdvice 中有多个 ExceptionHandler 用于相同的异常但不同的 Web 请求?