bi.bars.Rd
When showing e.g., age or education distributions for two groups, it is convenient to plot them back to back. bi.bars will do so.
bi.bars(x,var=NULL,grp=NULL,horiz,color,label=NULL,zero=FALSE,xlab,ylab,...)
The data frame or matrix from which we specify the data
The variable to plot
a grouping variable.
horizontal (default) or vertical bars
colors for the two groups – defaults to blue and red
If specified, labels for the dependent axis
If TRUE, subtract the minimum value to make the numbers range from 0 to max -min. This is useful if showing heights
xaxis label if appropriate
y axis label otherwise
Further parameters to pass to the graphing program
A trivial, if useful, function to draw back to back histograms/barplots. One for each group.
a graphic
describe
, describeBy
and statsBy
for descriptive statistics and error.bars
error.bars.by
and densityBy
violinBy
for graphic displays
#data(bfi)
bi.bars(bfi,"age","gender" ,ylab="Age",main="Age by males and females")
bi.bars(bfi,"education","gender",xlab="Education",
main="Education by gender",horiz=FALSE)