hierobarp.svymean {plotrix} | R Documentation |
Displays a nested breakdown as a bar plot of means from the output of svyby (survey package) using svymean as the function.
hierobarp.svymean(x,meanvar,dispvar,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)
x |
The output of the svyby function using svymean. See Details. |
meanvar |
The name of the column containing the mean values. |
dispvar |
The name of the column containing the SE values. |
xlim,ylim |
Optional x and y limits for the plot. |
main |
Title for the plot. |
xlab,ylab |
Axis labels for the plot. X axis labels are usually left out |
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. |
hierobarp.svymean displays a bar plot illustrating the breakdown of a numeric variable as group means. 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 svymean 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.
nil
Jim Lemon