Learn R Programming

TexMix (version 0.5.3)

plotBoxesByFactor: Layout of box-plots: variables by factor

Description

plotBoxesByFactor generates box-plots of several variable by a factor.

Usage

plotBoxesByFactor(xVars, groups, ncol=3, zTrans=TRUE, varwidth=FALSE)

Arguments

xVars

data-frame of metric variables.

groups

factor variable.

ncol

number of layout columnes.

zTrans

logical. xTrans=TRUE performs a z-transformation of all variables.

varwidth

logical. varwidth=TRUE makes the box width proportional to the number of observation used to generate the box for a specific factor level.

Details

This function organizes several box-plots of metric variables broken by a factor variable in to a layout. By default 3 box-plots are shown per row and the variables are standardized by the z-transformation. As the number of factor levels increases the number of plots per row should be decreased to maintain a reasonable visual resolution.

Examples

Run this code
# NOT RUN {
varsKeep <- c("PCTWHITE","PCTBLACK","PCTASIAN","PCTHISPAN","MEDAGE","MEDVALHOME")
myData <- tractShp@data
plotBoxesByFactor(myData[,varsKeep], tractShp$CITYPERI, ncol=2, zTrans=TRUE, varwidth=FALSE)
# }

Run the code above in your browser using DataLab