Create a ggplot2 object with a line for each sample that spans from its pre-training to post-training value.

plot_pre_post(x, pre, post, stats = NULL, ymin, ymax)

Arguments

x

data.frame with pre and post values. The data should be filtered to a specific age and sex.

pre

character; name of a column in x containing pre-training values.

post

character; name of a column in x containing post-training values.

stats

data.frame with post - pre stats for each training group. The data should be filtered to a specific measure, age, and sex.

ymin

numeric; lower bound on y-axis.

ymax

numeric; lower bound on y-axis.

Value

A ggplot object.

Details

Lines are colored according to whether the change from pre to post is an increase (red) or decrease (blue). If the pre and post values are the same (no change), a black point is used instead of a line. Originally, the post end of each line terminated in an arrow, but the final figure panels were too small to display them properly. Also, the arrows were somewhat misleading when the post - pre differences were small enough to be hidden by the arrow heads.