Learn R Programming

memisc (version 0.97)

panel.errbars: Panel Functions for Error Bars

Description

panel.errbars plots points are draws a line suppelemented with error bars.

Usage

panel.errbars(x,y,...,panel.xy=panel.xyplot,
                make.grid=c("horizontal","vertical","both","none"),ewidth=0)

Arguments

x,y
numeric values, the points around which error bars are plotted. x is a numeric vector, y is a matrix with three columns, the values, the lower and the upper ends of the error bars.
...
graphical parameters passed to panel.xy
panel.xy
panel function to produce the plot to which error bars are added
make.grid
character string, determines the direction of grid lines added to the plot
ewidth
numerical value, width of the whiskers of the error bars

See Also

panel.xyplot

Examples

Run this code
library(lattice)
library(grid)
if(interactive())
  old.prompt <- grid::grid.prompt(TRUE)

applications <- Aggregate(percent(Dept,weight=Freq,ci=TRUE)~Gender,
                                      data=UCBAdmissions)
admissions <- Aggregate(
        percent(Admit=="Admitted",weight=Freq,ci=TRUE)~Dept+Gender,
                                      data=UCBAdmissions)
xyplot(cbind(Percentage,lower,upper)~Gender|Dept,data=admissions,
      panel=panel.errbars,
      ewidth=.2,pch=19,
      ylab="Percentage applicants admitted by Department")
xyplot(cbind(Percentage,lower,upper)~Gender|Dept,data=applications,
      panel=panel.errbars,
      ewidth=.2,pch=19,
      ylab="Percentage applications to the Department")

if(interactive())
  grid::grid.prompt(old.prompt)

Run the code above in your browser using DataLab