spread function

Construct scatterplot / boxplots for the data

Construct scatterplot / boxplots for the data

Function constructs the plots depending on the types of variables in the provided matrix / data frame.

spread(data, histograms = FALSE, log = FALSE, lowess = FALSE, ...)

Arguments

  • data: Either matrix or data frame with the data.
  • histograms: If TRUE, then the histograms and barplots are produced on the diagonal of the matrix. Otherwise the names of the variables are written there.
  • log: If TRUE, then the logarithms of all numerical variables are taken.
  • lowess: If TRUE, then LOWESS lines are added to scatterplots and means are connected with lines on boxplots, see lowess for details.
  • ...: Other parameters passed to the plot function. Currently only "main" parameter is accepted.

Returns

Function does not return anything. It just plots things.

Details

If both variables are in metric scale, then the classical scatterplot is constructed. If one of them is either integer (up to 10 values) or categorical (aka 'factor'), then boxplots (with grey dots corresponding to mean values) are constructed. Finally, for the two categorical variables the tableplot is returned (see tableplot function for the details). All of this is packed in a matrix. The colours in the plot can be changed by defining a different palette via the palette() function, in which case spread() will use the first four colours in the pallete.

See details in the vignette "Marketing analytics with greybox": vignette("maUsingGreybox","greybox")

Examples

### Simple example spread(mtcars) spread(mtcars,log=TRUE)

See Also

plot, table, tableplot

Author(s)

Ivan Svetunkov, ivan@svetunkov.com

  • Maintainer: Ivan Svetunkov
  • License: LGPL-2.1
  • Last published: 2025-04-04