Learn R Programming

mixAK (version 2.2)

plotProfiles: Plot individual longitudinal profiles

Description

It creates a plot of individual longitudinal profiles. It is based on the output from getProfiles function.

Usage

plotProfiles(ip, data, var, trans, tvar, gvar,
             auto.layout=TRUE, lines=TRUE, points=FALSE, add=FALSE,
             xlab="Time", ylab, xaxt="s", yaxt="s", xlim, ylim, main, col="darkblue",
             lty=1, lwd=1, pch=16)

Arguments

ip
output from getProfiles function containing extracted individual longitudinal profiles of each subject.
data
data.frame used to produce ip. It is used to detect ranges for some variables.
var
character string identifying the response variable to plot.
trans
possible transformation of the response variable.
tvar
character string identifying the time variable.
gvar
character string identifying the group variable for which different colors are used.
auto.layout
logical. If TRUE, the layout of the plotting region is determined automatically.
lines
logical. If TRUE, lines are drawn in the plot connecting observations within individuals.
points
logical. If TRUE, points are added to the plot.
add
logical. If TRUE, the new plot overlays the old one.
xlab, ylab, xaxt, yaxt, xlim, ylim, main, col, lty, lwd, pch
arguments passed to standard plotting functions. col might also be a vector in which case different colors are used for profiles from different groups identified by the gvar variable.

Value

  • Invisible ip.

See Also

getProfiles.

Examples

Run this code
data(PBCseq, package="mixAK")
ip <- getProfiles(t="day", y=c("age", "fdrug", "bili", "platelet", "spiders"),
                  id="id", data=PBCseq)

XLIM <- c(0, 910)
lcol2 <- c("darkgreen", "red")

oldPar <- par(mfrow=c(1, 3), bty="n")
plotProfiles(ip=ip, data=PBCseq, xlim=XLIM, var="bili", trans=log, tvar="day", gvar="fdrug",
             xlab="Time (days)", col=lcol2, auto.layout=FALSE, main="Log(bilirubin)")
plotProfiles(ip=ip, data=PBCseq, xlim=XLIM, var="platelet", tvar="day", gvar="fdrug",
             xlab="Time (days)", col=lcol2, auto.layout=FALSE, main="Platelet count")
plotProfiles(ip=ip, data=PBCseq, xlim=XLIM, var="spiders",  tvar="day", gvar="fdrug",
             xlab="Time (days)", col=lcol2, auto.layout=FALSE, lines=FALSE, points=TRUE)
par(oldPar)

Run the code above in your browser using DataLab