longContPlot: Plot Longitudinal Continuous Data

View source: R/longContPlot.R

longContPlotR Documentation

Plot Longitudinal Continuous Data

Description

This function creates a plot for longitudinal continuous data, optionally adding a random "jog" to each data point to reduce overplotting. It allows specifying the x and y limits and uses either provided or automatically calculated times for plotting.

Usage

longContPlot(y, times = NULL, jog = FALSE, ylim = NULL, xlim = NULL, ...)

Arguments

y

Numeric matrix of data to plot.

times

Optional; numeric vector or matrix of times corresponding to 'y' values.

jog

Logical; if TRUE, adds a random jog to the data to reduce overplotting.

ylim

Numeric vector; the range of y values to be plotted.

xlim

Numeric vector; the range of x values (times) to be plotted.

...

Additional arguments to be passed to the plot function.

Examples

# longitudinal plot
times <- c(1,100,200,300,400,500)
par(mfrow=c(1,1), bg='cornsilk3')
longContPlot(example2cont, times, ylim=c(-2,6), main='', ylab='', xlab='Day')
par(mfrow=c(1,1), bg='transparent')

# jogging example
times <- c(1,100,200,300,400,500)
par(mfrow=c(1,2), bg='cornsilk3')
longContPlot(example2cat, times,           ylim=c(0,6),
             main='Growth Curves', ylab='', xlab='Days')
longContPlot(example2cat, times, jog=TRUE, ylim=c(0,6),
             main='Growth Curves + Jogging',
             ylab='', xlab='Days')
par(mfrow=c(1,1), bg='transparent')# compare growth curves to longCat

stueller/longCatEDA documentation built on March 9, 2024, 4:08 a.m.