xqplot: Extended Quantile Plots

View source: R/graphics.R

xqplotR Documentation

Extended Quantile Plots

Description

An easy way to see a dataset's variables at a glance. Shows uniform quantile plot for numerical varibles and barcharts for factors. Quantile plots also show a horizontal line at the position of the mean and at mean plus or minus one standard deviation.

Usage

xqplot(
  x,
  ptype = "quantile",
  labels = dimnames(x)[[2]],
  ...,
  mfrow = findmfrow(ncol(x)),
  ask = FALSE,
  mcex = 0.8,
  maxlab = 12,
  debug = F,
  mar = c(4, 2.5, 4, 1),
  xlab.pos = 2,
  xlab.cex = 0.7,
  sublab.pos = xlab.pos + xlab.cex * 1.15,
  text.cex.factor = 1,
  left.labs = F,
  class = TRUE,
  xaxs = "i",
  maxvarnamelength = 20
)

xqplot_(
  x,
  ptype = "quantile",
  labels = names(x),
  ...,
  mfrow = findmfrow(length(x)),
  ask = FALSE,
  mcex = 0.8,
  maxlab = 12,
  debug = F,
  mar = c(4, 2.5, 4, 1),
  xlab.pos = 2,
  xlab.cex = 0.7,
  sublab.pos = xlab.pos + xlab.cex * 1.15,
  text.cex.factor = 1,
  left.labs = F,
  class = TRUE,
  xaxs = "i",
  maxvarnamelength = 20
)

Arguments

x

a data frame or list of variables to plot

ptype

"quantile" (default) or "normal": kind of quantile to plot on x axis.

labels

names for each plot

...

additional arguments passed to 'plot' command

mfrow

number of rows and columns per page. If missing, an attempt is made to choose a reasonable number.

ask

if TRUE pause after each page, default: FALSE

mcex

character expansion factor for marginal text mcex

maxlab

maximum number of categories to label in barcharts

debug

if TRUE, print additional information

mar

size of margins

xlab.pos

position of xlab, default: 2

xlab.cex

cex for xlab, default: .7

sublab.pos

position for sublab, default: xlab.pos + xlab.cex * 1.15

text.cex.factor

character expansion factor for barchart labels

left.labs

determines placement of barchart labels

class

show class of object, default: TRUE

xaxs

style of x axis, default: 'i'

maxvarnamelength

maximum length of variable name without splitting on two lines.

Functions

  • xqplot_(): experimental version to handle data.frames with list elements

Note

Bugs: 'mfrow' should take the total number of variables into account if they will fill more than one page so the last page is close to being full.

The current version of the function could be made much simpler and more transparent. Some code is redundant.

Examples

require(car)
xqplot(Prestige)
xqplot(Prestige,"n") # normal quantiles

gmonette/spida2 documentation built on Aug. 11, 2024, 7:52 p.m.