我試圖在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", 行。 names = c(NA。 -5L))
我使用的代碼
library(reshape)
library(ggplot2)
library(ggpubr)
regcovMat <- read.table("Test. txt", sep=" "。 header=T)
molten.data <-熔化(regcovMat)
stat.test <- compare_means()
值~變數,資料=molten.資料,
方法 = "t.test"
)
data=ggplot(molten. data, aes(x=variable, y=value。 fill=variable))
geom_boxplot() theme_cowplot() theme(legend. position = "top")。
資料 stat_pvalue_manual(stat. test, label = "p")
誰能建議我解決這個問題?
uj5u.com熱心網友回復:
library(reshape)
library(ggplot2)
library(ggpubr)
library(cowplot)
#>
#> Attaching package: 'cowplot'
#> 以下物件被屏蔽在'package:ggpubr'中:
#>
#> get_legend
#> 以下物件被掩蓋在'package:reshape'中:
#>
#> stamp
regcovMat < -結構(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, /span> -0. 087)。 data4 = c(-0. 070, -0.072, -0. 035, -0.001, -0. 021)), class == "data. frame",行。 names = c(NA。 -5L))
molten.data <-熔化(regcovMat)
#> 用作id變數
stat.test <- compare_means()
值~變數,
資料 = molten.data,
方法 = "t.test"
)
ggplot(molten.data)
geom_boxplot(aes(x = variable, y = value。 填充=變數))
stat_pvalue_manual(stat.test, label = "p", y. position = 0.15, step。 增加= 0.2)
theme_cowplot()
主題(legend.position = "top")

轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/318924.html
標籤:

