boxplotC {RCPA3}R Documentation

Generates box plots to compare interval-level dependent variable's distribution across categories of independent variable.

Description

Generates box plots for visual comparison of interval-level dependent variable's distribution across categories of independent variable. Includes option for weighting observations, modifying colors, variable widths. Box plot can be used to compare values of interval-level dependent variable by categories of an independent variable (a factor).

Usage

boxplotC(dv, iv, w, data, main, xlab, ylab, box.col, varwidth = TRUE, ivlabs,
  printC = FALSE, ...)

Arguments

dv

Dependent variable, should be in dataset$var form unless dataset specified in optional data argument.

iv

Independent variable, should be in dataset$var form unless dataset specified in optional data argument.

w

(Optional) Sampling weights of variable, must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument.

data

(Optional) Name of dataset that contains dv, iv (and w) variables (optional).

main

(Optional) Supply custom main label for plot; default uses names of dv and iv.

xlab

(Optional) Supply custom x-axis label for plot; default uses name of iv.

ylab

(Optional) Supply y-axis label for plot; default uses name of dv.

box.col

(Optional) The name of color to use for box colors. Default is "gray80".

varwidth

(Optional) Do you want the widths of boxes to be proportional to number of observations in each group? Default is TRUE; set varwidth=FALSE for equal-width boxes.

ivlabs

(Optional) A vector of labels for the iv values that are box lablels.

printC

(Optional) Do you want to print box plot to .html file in working directory? (Default: FALSE)

...

Additional arguments passed to plotting functions, boxplot or bxp.

Value

No return, creates a plot.

RCPA3 Package Tutorial Videos

Textbook References

Online Resources

Examples

  library(RCPA3)
   
  # basic usage with variables as vectors
  boxplotC(dv=nes$ft.rep, iv=nes$partyid3)
  
  # with w and data arguments
  boxplotC(dv=ft.rep, iv=partyid3, w=wt, data=nes)

[Package RCPA3 version 1.2.1 Index]