profilePlotR: Generating profile plots for longitudinal data, with repeated...

View source: R/BiomechanicsFunctions.R

profilePlotRR Documentation

Generating profile plots for longitudinal data, with repeated measures

Description

The following function calculates the summary statistics for groups that have multiple observations and then plots the mean and confidence interval for each group. The confidence interval is based on the lower and upper Gaussian confidence limits based on the t-distribution.

Usage

profilePlotR(d = d, xvar = xvar, yvar = yvar, groupname = groupname, xlab = "x", ylab = "y", colorPalette = c("#D55E00", "#0072B2", "#56B4E9"), linetypes = NULL, grouplevels = NULL, title = NULL, ...)

Arguments

d

data (currently only accepts input for one variable at a time).

xvar

x-axis variable name.

yvar

y-axis variable name.

groupname

variable name for the overall group that is being evaluated (e.g., species).

xlab

character string for the x-axis label.

ylab

character string for the y-axis label.

colorPalette

character string of colors to use for plot.

linetypes

character string of lines to use for each group.

grouplevels

character string of the text to print for each group in the legend.

title

character string for the title of the plot.

Details

Function to quickly generate profile plots for data. For instance, kinematic plots over time for multiple individuals that have multiple trials of data collected.

Examples

percentStance = rep(seq(1,5),4)
yank = c(0.00062, 0.00172, 0.00269, 0.00346, 0.00412, 0.0022, 0.00072, 0.00169, 0.00246, 0.00312, 0.00028, 0.00084, 0.00151, 0.00239, 0.00340, 0.00041, 0.00122, 0.00202, 0.00277, 0.00341)
species = c("ab" , "ab", "ab", "ab", "ab", "ab", "ab", "ab", "ab", "ab", "cd", "cd", "cd", "cd", "cd", "cd", "cd", "cd", "cd", "cd")
df <- data.frame(percentStance, yank, species)
cbPalette <- c("#D55E00", "#0072B2")
grouplevels = c("Aa bb", "Cc dd")
profilePlotR(df, "percentstance", "yank", "species", "Percent Stance", "Yank (BW per sec)", colorpalette = cbPalette, grouplevels = grouplevels)


MorphoFun/kraken documentation built on July 2, 2022, 1:13 p.m.