Function constructs the plots depending on the types of variables in the provided matrix / data frame.
spread(data, histograms = FALSE, log = FALSE, lowess = FALSE, ...)
Function does not return anything. It just plots things.
Either matrix or data frame with the data.
If TRUE
, then the histograms and barplots are produced on
the diagonal of the matrix. Otherwise the names of the variables are written there.
If TRUE
, then the logarithms of all numerical variables are taken.
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.
Ivan Svetunkov, ivan@svetunkov.com
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")
### Simple example
spread(mtcars)
spread(mtcars,log=TRUE)
Run the code above in your browser using DataLab