View source: R/stat_frdAllPairsNemenyiTest.R
stat_frdAllPairsNemenyiTest | R Documentation |
Uses PMCMRplus::frdAllPairsNemenyiTest()
to perform Nemenyi's all-pairs
comparisons tests of Friedman-type ranked data and adds the
resulting p-values to the plot. The grouping aesthetics will be used as the
block for frdAllPairsNemenyiTest
.
Only works if the x-axis is a discrete scale.
stat_frdAllPairsNemenyiTest( mapping = NULL, data = NULL, geom = GeomStat, position = "identity", na.rm = FALSE, show.legend = NA, size = 10, hide.ns = TRUE, tick.length = 0.02, format.fun = pvalue, vjust = 0, step.increase = 0.05, colour = "black", inherit.aes = TRUE, ... )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
the geometric object to use display the data. Set to |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
size |
Fontsize for the annotation |
hide.ns |
Should p-values lower than 0.05 be removed? Default TRUE |
tick.length |
Length of the ticks in the p-value brackets. Default 0.02 |
format.fun |
A function used to format the p value. Default |
vjust |
A numeric vector specifying vertical justification. Passed on to textGrob. |
step.increase |
Amount of increase between two brackets. Default 0.05 |
colour |
Colour of the bracket and label |
inherit.aes |
If |
... |
Further arguments passed on to the layer in params |
A ggplot layer
library(ggplot2) library(ggsimplestats) theme_set(ggthemes::theme_few()) df <- data.frame(patient=as.factor(rep(1:5, each=4)), drug=as.factor(rep(1:4, times=5)), response=c(30, 28, 16, 34, 14, 18, 10, 22, 24, 20, 18, 30, 38, 34, 20, 44, 26, 28, 14, 30)) ggplot(df, aes(x=drug, y=response, color=patient)) + geom_point(position = position_dodge(width = .2)) + stat_frdAllPairsNemenyiTest(aes(group = patient))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.