msdplot: Plot means and standard deviations with a dotplot

View source: R/msdplot.r

msdplotR Documentation

Plot means and standard deviations with a dotplot

Description

Function to plot means and confidence limits.

Usage

msdplot(
  trait,
  groups,
  dfr,
  conf = 0.95,
  dotplot = TRUE,
  sort.means = c("none", "increasing", "decreasing"),
  main.title = NULL,
  color = c("orange", "orange", "black"),
  x.las = 1,
  jf = 0.1,
  hsep = 0.1,
  ...
)

Arguments

trait

The name of the column for the trait to plot.

groups

The name of the column for the grouping factor.

dfr

The name of the data frame.

conf

Probability for the confidence limits or number of standard deviations.

dotplot

Logical. If TRUE, a dotplot is shown.

sort.means

Sort for means. Options are "none", "increasing", and "decreasing", "none" by default.

main.title

Main title.

color

Color for mean symbols, confidence interval lines, and data points.

x.las

x axes labels orientation.

jf

Jitter factor for dots.

hsep

Horizontal separation between the means and the dots.

...

Additional plot arguments.

Details

An alternative to the controversial dynamite plots. If conf is set to a value greater than or equal to 1, then it is interpreted as number of standard deviations.

Value

It returns a plot with the means represented by horizontal lines, a vertical line representing a confidence limit or a number of standard deviations, and alternatively the individual data points.

Author(s)

Raul Eyzaguirre

Examples

# Simulate some data
dfr <- data.frame(y = rnorm(50, sample(40:60, 5), sample(5:10, 5)),
                  g = rep(1:5, 10))
msdplot("y", "g", dfr, lwd = 2, pch = 4)

reyzaguirre/st4gi documentation built on Sept. 17, 2024, 8:44 p.m.