Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

longContPlot

Plot Continuous Longitudinal Data


Description

Function to plot continuous longitudinal or time-series data.

Usage

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

Arguments

y

a data matrix or data frame in wide (as opposed to long) format with cases in rows and repeated observations in columns.

times

time points used for the x-axis in plotting. Either a vector of the same length as the number of columns in y (i.e., all cases have the same times of observation), or a matrix of the same dimension as y (i.e., individually varying times of observation). Default is NULL and is assigned the value 1:ncol(y).

jog

When y is integer data, it can be useful to jog all values by a small amount. When jog=TRUE, a random uniform variate in [-.25, .25] is added to each row in y.

ylim

see par. Default is NULL and calculated from y.

xlim

see par. Default is NULL and calculated from y.

...

Arguments to be passed to plot. See par.

Author(s)

Stephen Tueller

References

Tueller, S. J., Van Dorn, R. A., & Bobashev, G. V. (2016). Visualization of categorical longitudinal and times series data (Report No. MR-0033-1602). Research Triangle Park, NC: RTI Press. http://www.rti.org/publication/visualization-categorical-longitudinal-and-times-series-data

See Also

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

longCatEDA

Package for Plotting Categorical Longitudinal and Time-Series Data

v0.31
GPL (>= 3)
Authors
Stephen Tueller. Funded by the National Institute on Drug Abuse (NIDA) Award number 1R03DA030850, the National Institute on Alcohol Abuse and Alcoholism (NIAAA) Award Number R03 AA019775, and the National Institute of Justice Award Number 2011-RY-BX-0003.
Initial release
2017-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.