小编Shr*_*M S的帖子

错误无法在数据中找到 y.position 变量 'y.position'

我正在尝试在 ggplot boxplot 中绘制重要值,但出现错误,无法理解为什么会出现此错误

我的数据

structure(list(data1 = c(0.05, 0.068, 0.063, 0.075, 0.047), 
      data2 = c(-0.029,-0.011,0.009,0.117,0.116), 
      data3 = c(-0.048,-0.030,-0.026,-0.049,-0.087), 
      data4 = c(-0.070,-0.072,-0.035,-0.001,-0.021)), 
      class = "data.frame", row.names = c(NA, -5L))
Run Code Online (Sandbox Code Playgroud)

我使用的代码

library(reshape)
library(ggplot2)
library(ggpubr)

regcovMat <- read.table("Test.txt", sep="\t", header=T)
molten.data <- melt(regcovMat)
stat.test <- compare_means(
  value ~ variable, data = molten.data,
  method = "t.test"
)

data=ggplot(molten.data, aes(x=variable, y=value, fill=variable)) + 
  geom_boxplot()+theme_cowplot()+theme(legend.position = "top")
data + stat_pvalue_manual(stat.test, label = "p")
Run Code Online (Sandbox Code Playgroud)

谁能建议我解决这个问题

r ggplot2

1
推荐指数
1
解决办法
3490
查看次数

标签 统计

ggplot2 ×1

r ×1