Creates a histogram of the specified p-values.

plot_pval_hist(
  dataset,
  P,
  bins = 20,
  line_color = "black",
  fill_color = "cornflowerblue",
  mean_color = "red",
  save_plot_path = FALSE,
  plot_filename = "pvalue_histogram.png"
)

Arguments

dataset

data imported to R by load_results().

P

column containing p-values to be plotted. State in the format dataset$P_value.

bins

number of bins used.

line_color

outline color of bins.

fill_color

fill color of bins.

mean_color

color of the line showing the mean value.

save_plot_path

if FALSE, return the function returns a ggplot object. Else a path of the directory to save the plot to.

plot_filename

name of the file to be saved, including file extension. Must be either .pdf, .png or .jpeg

Value

Either returns a ggplot object or saves the plot to save_plot_path and returns NULL.

Details

Use analysis_association() to obtain p-values for an analysis and import these with load_results().
The function also draws a line on the y-axis showing the mean of the p-values.
vignette("ggplot2-specs", package = "ggplot2") details the usage of aesthetic parameters in ggplot2.