Learn R Programming

Ecfun (version 0.2-0)

qqnorm2t: Normal Probability Plot with Multiple Lines and Multiple Symbols

Description

Create a normal probability plot of y with one line for each level of a factor or character variable x and (optionally) different symbols for the different levels of a variable z.

To create a normal probability plot with one line for each of multiple y variables, see qqnorm2s.

To create a normal probability plot with one line and different symbols for each level of a variable z, see qqnorm2.

Usage

qqnorm2t(y, x, z=NULL, data., plot.it=TRUE, 
    datax=TRUE, outnames=NULL, pch=NULL, 
    col=c(1:4, 6), legend.=NULL, ...)

Arguments

y

a character vector of length 1 with the name of a column of data. for which normal probability plots are desired, with one line for each level of x.

x

a factor or character vector indicating how to split y for plotting.

z

A character vector giving the name of a column of data. to indicate different plotting symbols.

data.

a data.frame with columns named in y, x, and z.

plot.it

logical: Should the result be plotted?

datax

The datax argument of qqnorm: If TRUE, the data are displayed on the horizontal rather than the vertical axis. (The default value for datax is the opposite of that for qqnorm.)

outnames

Names for the components of the qqnorm2s object returned by the qqnorm2s function. Equal to the levels of x by default.

pch

a named vector of the plotting symbols to be used with names corresponding to the levels of z.

By default, if z takes levels FALSE and TRUE (or 0 and 1), pch=c(4, 1) to plot a "x" for FALSE and "o" for TRUE.

If z assumes integer values between 0 and 255, by default, the symbols are chosen as described with points.

Otherwise, by default, z is coerced to character, and the result is plotted.

If pch is provided, it must either have names corresponding to levels of z, or z must be integers between 1 and length(pch).

col

A vector indicating the colors corresponding to each element of x. Defaults to rep(c(1:4, 6), length=length(x)), with 1:4 and 6 being black, red, green, blue, and pink.

legend.

A list with components pch and col providing information for legend to identify the plotting symbols (pch) and colors (col).

By default, pch = list(x='right', legend=names(qq2s[[1]][['pch']]), pch=qq2s[[1]][['pch']]), where qq2s is described below in details.

Similarly, by default, lines = list(x='bottomright', legend=y, lty=1, pch=NA, col=qq2s[[1]][['col']]).

Optional arguments.

For plot.qqnorm2s, they are passed to plot.

For qqnorm2s, they are passed to qqnorm2 and to plot.qqnorm2s.

Value

Returns an object of class qqnorm2s.

Details

data. is split by x and the result is passed to qqnorm2s

See Also

qqnorm2, qqnorm2s, plot

Examples

Run this code
# NOT RUN {
##
## One data.frame
##
tstDF2 <- data.frame(y=1:6, x=c('a','b'), 
    z2=c(TRUE, TRUE, FALSE),
    z3=c('tell', 'me', 'why') )
# produce the object and plot it
Qnt <- qqnorm2t('y', 'x', 'z2', tstDF2)

# plot the object previously created
plot(Qnt)

Qnt0 <- qqnorm2t('y', 'x', data.=tstDF2)
# without z 
qqnorm2t('y', 'x', data.=tstDF2)
# }

Run the code above in your browser using DataLab