用到
stat_compare_means
函數(shù)
兩種用法:
一、用aes函數(shù)映射
stat_compare_means(aes(group = group),
method = "wilcox.test",
hide.ns = F,na.rm = T,
label="p.signif")
這個(gè)方法可以在組內(nèi)進(jìn)行比較
二、用comparison添加
stat_compare_means(method="wilcox.test",
comparison=comparison,#必須是個(gè)List
hide.ns = F,
label="p.signif")
這個(gè)只能在組間進(jìn)行比較,comparison的賦值必須是x軸上的值
“長(zhǎng)度為2的向量列表。向量中的條目要么是x軸上2個(gè)值的名稱,要么是對(duì)應(yīng)于要比較的感興趣組索引的2個(gè)整數(shù)。”
A list of length-2 vectors. The entries in the vector are either the names of 2 values on the x-axis or the 2 integers that correspond to the index of the groups of interest, to be compared.