hierobarp.svyprop {plotrix}R Documentation

Display a nested breakdown of numeric proportions.

Description

Displays a nested breakdown as a bar plot of proportions from the output of svyby (survey package) using svytotal as the function.

Usage

 hierobarp.svyprop(x,truevar,falsevar,xlim=NULL,ylim=NULL,
  main="",xlab="",ylab="",yticks=NULL,start=0,end=1,shrink=0.02,
  errbars=FALSE,col=NA,labelcex=1,lineht=NA,showall=TRUE,barlabels=NULL,
  showbrklab=TRUE,mar=NULL)

Arguments

x The output of the svyby function using svytotal when there are two outcomes. See Details.
truevar The name of the column containing the count of TRUE values.
falsevar The name of the column containing the count of FALSE values.
xlim,ylim Optional x and y limits for the plot.
main Title for the plot.
xlab,ylab Axis labels for the plot.
yticks Optional tick labels for the y-axis.
start,end The start and end values of the initial display. The user will almost certainly not want to change these.
shrink The proportion to shrink the width of the bars as more levels are added. This proportion increases with the number of levels.
errbars Whether to display error bars on the lowest level of breakdown.
col The colors to use to fill the bars. See Details.
labelcex Character size for the group labels.
lineht The height of a line of text in the lower margin of the plot in user units. This will be calculated by the function if a value is not passed.
showall Whether to display bars for the entire breakdown.
barlabels Optional group labels that may be useful if the factors used to break down the numeric variable are fairly long strings.
showbrklab Whether to display the labels for the lowest level of breakdown.
mar If not NULL, a four element vector to set the plot margins. If new margins are set, the user must reset the margins after the function exits.

Details

hierobarp.svyprop displays a bar plot illustrating the breakdown of a binary outcome as proportions. This can be useful in visualizing the relationship between groups and subgroups in a compact format. While the function can be used with just the output of the svyby and svytotal functions, the user will almost certainly have the survey package installed.

The colors of the bars are determined by col. A list with as many elements as there are levels in the breakdown should be passed. Each element should be a vector of colors, again usually the same length as the number of categories. As the categorical variables are likely to be factors, it is important to remember that the colors must be in the correct order for the levels of the factors. When the levels are not in the default alphanumeric order, it is quite easy to get this wrong.

Value

nil

Author(s)

Jim Lemon

See Also

hierobarp, barp


[Package plotrix version 2.7-2 Index]