Learn R Programming

r6qualitytools (version 1.0.1)

mvPlot: mvPlot: Function to create a multi-variable plot

Description

Creates a plot for visualizing the relationships between a response variable and multiple factors.

Usage

mvPlot(
  response,
  fac1,
  fac2,
  fac3,
  fac4,
  sort = TRUE,
  col,
  pch,
  labels = FALSE,
  quantile = TRUE,
  FUN = NA
)

Value

mvPlot returns an invisible list cointaining: a data.frame in which all plotted points are listed and the final plot. The option labels can be used to plot the row-numbers at the single points and to ease the identification.

Arguments

response

The values of the response in a vector.response must be declared.

fac1

Vector providing factor 1 as shown in the example.fac1 must be declared.

fac2

Vector providing factor 1 as shown in the example.fac2 must be declared.

fac3

Optional vector providing factor 3 as shown in the example.

fac4

Optional vector providing factor 4 as shown in the example.

sort

Logical value indicating whether the sequence of the factors given by fac1 - fac4 should be reordered to minimize the space needed to visualize the Multi-Vari-Chart. By default sort is set to `TRUE`.

col

Graphical parameter. Vector containing numerical values or character strings giving the colors for the different factors. By default col starts with the value `3` and is continued as needed.

pch

Graphical parameter. Vector containing numerical values or single characters giving plotting points for the different factors. See points for possible values and their interpretation. Note that only integers and single-character strings can be set as a graphics parameter (and not NA nor NULL). By default pch starts with the value `1` and is continued as needed.

labels

Logical value indicating whether the single points should be labels with the row-number of the data.frame invisibly returned by the function mvPlot. By default labels is set to `FALSE`.

quantile

A logical value indicating whether the quanitiles (0.00135, 0.5 & 0.99865) should be visualized for the single groups. By default quantile is set to `TRUE`.

FUN

An optional function to be used for calculation of response for unique settings of the factors e.g. the mean. By default FUN is set to `NA` and therfore omitted.

Examples

Run this code
#Example I
examp1 = expand.grid(c("Engine1","Engine2","Engine3"),c(10,20,30,40))
examp1 = as.data.frame(rbind(examp1, examp1, examp1))
examp1 = cbind(examp1, rnorm(36, 1, 0.02))
names(examp1) = c("factor1", "factor2", "response")
mvPlot(response = examp1[,3], fac1 = examp1[,2],fac2 = examp1[,1],sort=FALSE,FUN=mean)

Run the code above in your browser using DataLab