Last data update: 2014.03.03
R: Plot individual longitudinal profiles
plotProfiles R Documentation
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,
lcol, col, bg, lty=1, lwd=1, pch=21, cex.points=1,
highlight, lines.highlight=TRUE, points.highlight=TRUE,
lcol.highlight="red3", col.highlight="red3", bg.highlight="orange",
lty.highlight=1, lwd.highlight=2,
pch.highlight=23, cex.highlight=1)
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.
lcol
color for lines.
col
color for points.
xlab, ylab, xaxt, yaxt, xlim, ylim, main, bg, 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.
cex.points
passed as a cex
argument to
points
function used when points = TRUE
.
highlight
an optional numeric vector giving the indeces of
ip
for which the longitudinal profiles should be highlighted.
lines.highlight
logical. If TRUE
, highlighting is done
using lines.
points.highlight
logical. If TRUE
, highlighting is done
using points.
lcol.highlight, col.highlight, bg.highlight, lty.highlight, lwd.highlight,
pch.highlight, cex.highlight
arguments col
, bg
, lty
,
lwd
, pch
, cex
passed to lines
and/or points
functions which provide highlighting of selected profiles.
Value
Invisible ip
.
Author(s)
Arno<c3><85><c2><a1>t Kom<c3><83><c2><a1>rek arnost.komarek[AT]mff.cuni.cz
See Also
getProfiles
.
Examples
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)",
highlight=c(2, 4), col.highlight="darkblue")
plotProfiles(ip=ip, data=PBCseq, xlim=XLIM, var="platelet", tvar="day", gvar="fdrug",
xlab="Time (days)", col=lcol2, auto.layout=FALSE, main="Platelet count",
highlight=c(2, 4), col.highlight="darkblue")
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,
highlight=c(2, 4), col.highlight="darkblue", bg.highlight="skyblue")
par(oldPar)
Results