discretePlot: Plot Distribution of Discrete Numeric Variable

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/discretePlot.R

Description

Plot the distribution of a discrete numeric variable, optionally classified by a factor.

Usage

1
2
discretePlot(x, by, scale = c("frequency", "percent"), 
    xlab = deparse(substitute(x)), ylab = scale, main = "")

Arguments

x

a numeric variable.

by

optionally a factor (or character or logical variable) by which to classify x.

scale

either "frequency" (the default) or "percent".

xlab

optional character string to label the horizontal axis.

ylab

optional character string to label the vertical axis.

main

optonal main label for the plot (ignored if the by argument is specified).

Details

If the by argument is specified, then one plot is produced for each level of by; these are arranged vertically and all use the same scale for x.

Value

Returns NULL invisibly.

Author(s)

John Fox jfox@mcmaster.ca

See Also

Hist, link{Dotplot}.

Examples

1
2
3
4
5
6
7
8
9
if (require(datasets)){
  data(mtcars)
  mtcars$cyl <- factor(mtcars$cyl)
  with(mtcars, {
    discretePlot(carb)
    discretePlot(carb, scale="percent")
    discretePlot(carb, by=cyl)
  })
}

Example output

Loading required package: car
Loading required package: carData
Loading required package: sandwich

RcmdrMisc documentation built on Aug. 13, 2020, 9:06 a.m.