Re: [R] Hmisc xYplot

From: Frank E Harrell Jr <>
Date: Mon 17 Jul 2006 - 23:27:27 EST

Erin Berryman wrote:
> Dear R community,
> I am having trouble with a particular plot that I am trying to produce
> using Hmisc's xYplot function. I've been using primarily lattice and
> Hmisc packages for my plotting needs for the past few years, with great
> success.
> However, what I want to do now with xYplot is plot more than one data
> trend in the same panel, much as I would use xyplot from package lattice
> in conjunction with superpose, with type="b". My problem is I can't get
> the error bars to plot when I use xYplot this way. I've attached my data
> set for reference.
> Here are my inputs:
> >p1sum<-read.csv(file="p1sum.csv", header=T)
> >library(Hmisc)
> >xYplot(Cbind(DRP, SE) + Cbind(Fe, FeSE) ~ Day | Group + Port, p1sum,
> type='b')
> The plotted result is two lines per panel, one labeled "Cbind(DRP, SE)"
> and the other labeled "Cbind(Fe, FeSE). However, the error bars are not
> plotted at all (I want the error bars to be DRP +/- SE, and Fe +/-
> FeSE). Any advice on this is greatly appreciated.
> Thank you,
> Erin

xYplot does not accept multiple Cbind terms. You'll have to string out your data "tall and thin" to construct a single Cbind(Y, SE) and use superposition with groups=.

Sometimes confidence intervals are better than using +-SE, which also has the advantage of allowing the intervals to be asymmetric.

> Erin Berryman
> ------------------------------------------------------------------------
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!

Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Mon Jul 17 23:33:03 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 18 Jul 2006 - 00:16:32 EST.

Mailing list information is available at Please read the posting guide before posting to the list.