DescTools (version 0.99.14)

PlotDesc: Display descriptive plots

Description

Specific descriptive plots depending on the class of x. These will typically be called by the Desc routines with the plotit argument set to TRUE.

Usage

PlotDesc(x, ..., wrd = NULL)

## S3 method for class 'default':
PlotDesc(x, ...)

## S3 method for class 'integer':
PlotDesc(x, main = deparse(substitute(x)),
         ord = c("val_asc","val_desc","frq_asc","frq_desc"),
         maxrows = 12, ... , wrd = NULL)

## S3 method for class 'numeric':
PlotDesc(x, main = deparse(substitute(x)), ...,
         wrd = NULL)

## S3 method for class 'factor':
PlotDesc(x, main = deparse(substitute(x)),
         ord = c("desc", "level", "name", "asc", "none"),
         maxrows = 12, lablen = 25, type = c("bar","dot"),
         col = NULL, border = NULL, xlim=NULL, ecdf=FALSE, ..., wrd = NULL)

## S3 method for class 'table':
PlotDesc(x, col1 = NULL, col2 = NULL,
         horiz = TRUE,  main="", ..., wrd = NULL)
## S3 method for class 'matrix':
PlotDesc(x, col1 = NULL, col2 = NULL,
         horiz = TRUE,  main="", ..., wrd = NULL)

## S3 method for class 'ordered':
PlotDesc(x, ..., wrd = NULL)

## S3 method for class 'data.frame':
PlotDesc(x, ..., wrd = NULL)

## S3 method for class 'logical':
PlotDesc(x, main = deparse(substitute(x)), xlab = "",
        col1 = getOption("col1", hblue),
        col2 = getOption("col2", hred), ..., wrd = NULL)

## S3 method for class 'Date':
PlotDesc(x, main = deparse(substitute(x)), breaks = NULL, ..., wrd = NULL)

## S3 method for class 'flags':
PlotDesc(x, ..., wrd = NULL)

PlotDescNumFact(formula, data, main = deparse(formula), notch=FALSE,
                add_ni = TRUE, ..., wrd = NULL)

PlotDescFactNum(x, y, ptab,
                col1 = getOption("col1", hblue), col2 = getOption("col2", hred),
                main=NULL, notch=FALSE, add_ni = TRUE, ... , wrd=NULL)

PlotDescNumNum(form1, form2, data, col = SetAlpha(1, 0.3), main = NULL,
               xlab = NULL, ylab = NULL, smooth = NULL, ..., wrd = NULL)

Arguments

x
the vector to be plotted.
main
the main title of the plot.
ord
the row order of a frequency table to be chosen. Is used for factors and integers.
maxrows
the maximum number of rows to be displayed for a factor.
lablen
the maximum numbe of characters for a factor level to be displayed, before the level is truncated and ... are added.
type
the type of plot to be used for describing factors. Can be "bar" for a horizontal barchart or "dot" for a dotchart.
col1, col2
two colors to be chosen for doing mosaicplots and logic plots.
col
color of the points used in a dotchart, typically for integers. Defaults to lightblue.
border
the color of the border, if the plottype is barplot or dotplot
xlab
the label for the x-axis.
ylab
the label for the y-axis.
xlim
the limits of the x-axis in factor plots.
ecdf
logical, defining if cumulative frequencies should be displayed in PlotDesc.factor. Defaults to FALSE.
breaks
vector of limits to bin a date.
horiz
logical, indicating if the two mosaicplots should be arranged horizontally (default is TRUE).
formula
a formula, such as y ~ grp, where y is a numeric vector of data values to be split into groups according to the grouping variable grp (usually a factor).
data
a data.frame (or list) from which the variables in formula should be taken.
notch
if notch is TRUE, a notch is drawn in each side of the boxes. If the notches of two plots do not overlap this is 'strong evidence' that the two medians differ.
add_ni
logical. Indicates if the group length should be displayed in the boxplot.
form1, form2
the formula used for calculating the smoother.
wrd
the pointer to a word instance. Can be a new one, created by GetNewWrd() or an existing one, created by GetCurrWrd(). Default is the last created pointer stored in getOption("lastWord").
y
the response variable
ptab
the proportions table for the deciles of x used in PlotDesc.flags.
smooth
character, either "loess" or "smooth.spline" defining the type of smoother to be used in num ~ num plots. Default is loess for n < 500 and smooth.spline else.
...
further arguments

Value

  • no value returned

Details

See the detailed description for informations about specific plots.

See Also

Desc

Examples

Run this code
PlotDesc(x=na.omit(d.pizza$delivery_min))    # numeric
PlotDesc(x=na.omit(d.pizza$week))            # integer
PlotDesc(x=na.omit(d.pizza$driver))          # factor
PlotDesc(x=na.omit(d.pizza$quality))         # ordered factor
PlotDesc(x=na.omit(d.pizza$wrongpizza))      # logical
PlotDesc(x=na.omit(d.pizza$date))            # Date

PlotDesc(x=na.omit(d.pizza$driver), ecdf = TRUE)          # factor

d.frm <- d.pizza[,c("price","operator")]
d.frm <- d.frm[complete.cases(d.frm),]
PlotDescNumFact(temperature ~ driver, data=d.pizza)       # numeric ~ factor

PlotDesc(table(d.pizza$driver, d.pizza$operator))         # factor ~ factor

Run the code above in your browser using DataCamp Workspace