nice.hist is a tool to examine a metric variable in data inspection, cleaning and description. A histogram with density curve is produced. Location and scale parameter as well as information on valid values can be displayed as legend right beside the plot. If the variable was already log10 transformed a log scale can be plotted. Outliers can be identified and filtered out using a +- factor* mad filer.

nice.hist(x, HISTCOL = 7, DENSCOL = 4, XLAB = NULL, YLAB = "Density",
  NCLASS = 40, ADJ = 1, MAIN = "Histogram with Density", XLIM = NULL,
  XAXP = NULL, DIGITS = 3, LEGEND = F, RUG = T, LOG10 = F,
  MADFILTER = 0, ANALYSISSTRING = "", CUTLINE = NULL)

Arguments

x

metric variable

HISTCOL

defines the colour of the histogram, default=7 (yellow)

DENSCOL

defines the colour of the density curve, default=4 (blue). DENSCOL=NA suppresses the density curve,

XLAB

specifies the x-axis-Label, if NULL the variable name of x is extracted from the call using PruneVarName

YLAB

="Density" specifies the y-axis-Label

NCLASS

defines the number of classes (=bins)in the histogram

ADJ

controls the smoothing of the density curve relative to default=1

MAIN

title of plot

XLIM

= NULL sets the x-axis range to be plotted manually - generally not necessary

XAXP

= NULL specifices ticks on x-axis - generally not necessary

DIGITS

controls the numbers of digits shown for location/scale parameters

LEGEND

set to TRUE to get extensive legend at right border instead a simple legend topright

RUG

=T logical whether to plot individual values above x-axis

LOG10

=F If true, x values are on the log10 scale and logarithmic x-axis is plotted

MADFILTER

=0, if >0 (typically 3,4, or 5) filter out Outliers

ANALYSISSTRING

="", optional string to indicate data source and/or date of analysis

CUTLINE

=NULL Draws vertical lines from cut values to the density curve (CAUTION: Later abline may use wrong coordinates)

Value

produces a histogram with density, if MADFILTER > 0 a logical selector vector is returned invisibly useful to examine outliers

See also