Learn R Programming

Hmisc (version 5.3-0)

histbackback: Back to Back Histograms

Description

Takes two vectors or a list with x and y components, and produces back to back histograms of the two datasets.

Usage

histbackback(x, y, brks=NULL, xlab=NULL, axes=TRUE, probability=FALSE,
             xlim=NULL, ylab='', ...)

Arguments

Value

a list is returned invisibly with the following components:

left

the counts for the dataset plotted on the left.

right

the counts for the dataset plotted on the right.

breaks

the breakpoints used.

See Also

Examples

Run this code
options(digits=3)
set.seed(1)
histbackback(rnorm(20), rnorm(30))


fool <- list(x=rnorm(40), y=rnorm(40))
histbackback(fool)
age <- rnorm(1000,50,10)
sex <- sample(c('female','male'),1000,TRUE)
histbackback(split(age, sex))
agef <- age[sex=='female']; agem <- age[sex=='male']
histbackback(list(Female=agef,Male=agem), probability=TRUE, xlim=c(-.06,.06))

Run the code above in your browser using DataLab