Description Usage Arguments Details Value Examples
Use ggplot2::geom_histogram()
to create a histogram of p-values but with
better binwidths and axis limits.
1 2 3 | gg_pval_hist(p_values, binwidth = 0.05)
geom_pval_hist(mapping = NULL, ..., binwidth = 0.05)
|
p_values |
Vector of p-values. |
binwidth |
Binwidth of the histogram. A sensible choice is to use the significance cut-off so that the height of the first bar corresponds to the number of significant cases. Default: 0.05. |
mapping |
Set of aesthetic mappings created by |
... |
Arguments passed on to
|
By default, ggplot2::geom_histogram()
centers the first and last bins of
the histogram on the x-axis lower and upper limits, respectively.
In case of p-values, which lie in the interval [0, 1], it makes more
sense to set the boundaries of the first and last bins at 0 and 1.
The binwidths are also set at 0.05, commonly used as a cut-off for significance,
so that the height of the first bar represents the number of p-values lying
between 0 and 0.05, i.e. the number of cases that would be deemed significant.
A ggplot object.
1 2 3 4 5 6 7 | pvals <- runif(n = 1000, min = 0, max = 1)
gg_pval_hist(pvals)
## Using a data.frame in combination with `ggplot`
library(ggplot2)
df <- data.frame(pvalue = runif(1000))
ggplot(df, aes(pvalue)) + geom_pval_hist()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.