uni.histograms: Histogram Panel

View source: R/02_data_preparation.R

uni.histogramsR Documentation

Histogram Panel

Description

The uni.histograms function draws, within a single panel, an independent histogram or each numeric (continuous or discrete) variable in a given dataset. It is particularly useful for data exploration (e.g. Zuur et al., 2010). For instance, to simultaneously observe the distributions of all numeric variables and determine which one will require transformation.

Usage

uni.histograms(
  dataset,
  MAR = c(3, 2, 0.5, 1.5),
  CEX.LAB = 1.2,
  FONT.LAB = 2,
  BTY = "n",
  FG = "gray35",
  COL.AXIS = "gray35",
  COL.LAB = "gray20",
  CEX.PAR = 0.6,
  TCL = -0.3,
  MGP = c(1.7, 0.6, 0.1),
  OMA = c(1, 0, 1, 0),
  LAB = c(5, 10, 7),
  BREAKS = 10,
  COL = "moccasin",
  BORDER = "white"
)

Arguments

dataset

The input dataset containing all variables to be plotted (must be a data.frame with at least 2 variables). It may contain all kinds of columns, the uni.histograms function will automatically detect and plot numeric variables (columns).

MAR

A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot. The default is c(0.5,4.1,1.1,1.5).

CEX.LAB

The magnification to be used for x and y labels relative to the current setting of CEX.PAR.

FONT.LAB

The font to be used for x and y labels.

BTY

A character string which determined the type of box which is drawn about plots. If BTY is one of "o", "l", "7", "c", "u", or "]" the resulting box resembles the corresponding upper case letter. A value of "n" suppresses the box (the default).

FG

The color to be used for the foreground of plots. This is the default color used for things like axes and boxes around plots (defaults to "gray35").

COL.AXIS

The color to be used for axis annotation. Defaults to "gray35".

COL.LAB

The color to be used for x and y labels. Defaults to "gray20".

CEX.PAR

A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default (for par, the panel manager). This starts as 1 when a device is opened, and is reset when the layout is changed, e.g. by setting mfrow. Defaults to 0.8.

TCL

The length of tick marks as a fraction of the height of a line of text. The default value is -0.3.

MGP

The margin line (in mex units) for the axis title, axis labels and axis line. Note that mgp[1] affects title whereas mgp[2:3] affect axis. The default is c(2.4, 0.6, 0).

OMA

A vector of the form c(bottom, left, top, right) giving the size of the outer margins in lines of text.

LAB

A numerical vector of the form c(x, y, len) which modifies the default way that axes are annotated. The values of x and y give the (approximate) number of tickmarks on the x and y axes and len specifies the label length. The default is c(5, 5, 7). Note that this only affects the way the parameters xaxp and yaxp are set when the user coordinate system is set up, and is not consulted when axes are drawn. len is unimplemented in R.

BREAKS

One of:

  • a vector giving the breakpoints between histogram cells,

  • a function to compute the vector of breakpoints,

  • a single number giving the number of cells for the histogram,

  • a character string naming an algorithm to compute the number of cells (see hist),

  • a function to compute the number of cells.

In the last three cases the number is a suggestion only; as the breakpoints will be set to pretty values, the number is limited to 1e6 (with a warning if it was larger). If breaks is a function, the x vector is supplied to it as the only argument (and the number of breaks is only limited by the amount of available memory).

COL

The color of the bar of the histograms (bins).

BORDER

The color of the border of the bars.

Value

A panel of histograms.

Examples

uni.histograms(dataset = iris[,1:4])

mrelnoob/jk.dusz.tarping documentation built on July 31, 2023, 9:19 a.m.