gg_ttest_between: Draw p-value between samples

Description Usage Arguments Value

View source: R/ggTTestBetween.R

Description

ggplot2 layer to perform a 2-sample t-test and plot the p-value between two samples in a bargraph. Used in conjunction with gg_bracket_between().

Usage

1
2
3
gg_ttest_between(data, sample_col, sample1, sample2, mean_col, sd_col, n_col,
  group_col = NA, group1 = NA, group2 = NA, equal.variance = T,
  dodge.width = 0.9, p_value_star = F, extra_y_space = 0, ...)

Arguments

data

The dataframe used in the plot

sample_col

Column name of the samples in data

sample1

The first sample to be compared

sample2

The second sample to be compared

mean_col

Column name of the means of the observations. Usually the y-axis of the bargraph.

sd_col

Column name for standard deviations of the observations.

n_col

Column name for number of replicates in an observation.

group_col

Optional – Column name of the sample groups if applicable. Leave NA if there are no groups.

group1

Optional – The group to which the first sample belongs. Leave NA if there are no groups.

group2

Optional – The group to which the second sample belongs. Leave NA if there are no groups.

equal.variance

Optional – Boolean for whether variances are equal. TRUE results in a student's t-test. FALSE results in a Welch test. Defaults to TRUE.

dodge.width

Optional – The width of position_dodge() in the ggplot if groups are present. Usually 0.9.

p_value_star

Optional – Boolean for whether to plot stars representing significance levels or actual p-values. TRUE plots '*'. FALSE plots p-values. '*' = p-value < 0.05, '**' = p-value < 0.01, '***' = p-value < 0.001, 'n.s.' = not significant.

extra_y_space

Optional – Numeric to adjust position of the bracket up or down from its default location.

...

Additional optional parameters/asthetics. e.g. color for font color or size for font size.

Value

ggplot2 annotation layer


azzoam/ggBrackets documentation built on June 4, 2017, 12:09 a.m.