Learn R Programming

greybox (version 0.6.4)

spread: Construct scatterplot / boxplots for the data

Description

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

Usage

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.

Value

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.

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

See Also

plot, table, tableplot

Examples

Run this code
# NOT RUN {
### Simple example
spread(mtcars)
spread(mtcars,log=TRUE)

# }

Run the code above in your browser using DataLab