qqnorm2s {Ecfun} | R Documentation |
Normal Probability Plot with Multiple Lines and Multiple Symbols
Description
Create a normal probability plot with one
line for each y
variable or each
data.frame
in a list data.
with different plotting symbols for the values
of z
.
To create a normal probability plot with one
y
variable split on a link{factor}
or character
variable x
,
see qqnorm2t
.
qqnorm2s
produces an object of class
qqnorm2s
, whose plot method produces
the plot.
Usage
qqnorm2s(y, z=NULL, data., plot.it=TRUE,
datax=TRUE, outnames=NULL, pch=NULL,
col=c(1:4, 6), legend.=NULL, ...)
## S3 method for class 'qqnorm2s'
plot(x, y, ...)
Arguments
y |
a The lengths of For |
z |
A character vector giving the names of
columns of |
data. |
a |
plot.it |
logical: Should the result be plotted? |
datax |
The |
outnames |
Names for the components of the
|
pch |
a named vector of the plotting symbols to
be used with names corresponding to the
levels of By default, if If Otherwise, by default, If |
col |
A vector indicating the colors corresponding
to each element of |
x |
an object of class |
legend. |
A list with components By default, Similarly, by default, |
... |
Optional arguments. For For |
Details
For qqnorm2s
:
1. Create qq2s
= a list of objects
of class qqnorm2
2. Add legend.
to qq2s
.
3. class(qq2s) <- 'qqnorm2s'
4. if(plot.it)plot(qq2s, ...)
5. Silently return(qq2s)
.
For plot.qqnorm2s
, create a plot with
one line for each variable named in y
.
Value
qqnorm2s
returns a named list with
components of class qqnorm2
with names
= y
with each component having an
additional component col
plus one
called "legend.
".
Author(s)
Spencer Graves
See Also
Examples
##
## One data.frame
##
tstDF2 <- data.frame(y=1:3, y2=3:5,
z2=c(TRUE, TRUE, FALSE),
z3=c('tell', 'me', 'why'),
z4=c(1, 2.4, 3.69) )
# produce the object and plot it
Qn2 <- qqnorm2s(c('y', 'y2'), 'z2', tstDF2)
# plot the object previously created
plot(Qn2)
# Check the object
qy <- with(tstDF2, qqnorm2(y, z2, type='b'))
qy$col <- 1
qy2 <- with(tstDF2, qqnorm2(y2, z2, type='b'))
qy2$col <- 2
legend. <- list(
pch=list(x='right',
legend=c('FALSE', 'TRUE'),
pch=c('FALSE'=4, 'TRUE'= 1)),
col=list(x='bottomright',
legend=c('y', 'y2'), lty=1, col=1:2))
Qn2. <- list(y=qy, y2=qy2, legend.=legend.)
class(Qn2.) <- 'qqnorm2s'
all.equal(Qn2, Qn2.)
##
## Two data.frames
##
tstDF2b <- tstDF2
tstDF2b$y <- c(0.1, 0.1, 9)
Qn2b <- qqnorm2s('y', 'z2',
list(tstDF2, tstDF2b),
outnames=c('ok', 'oops'), log='x' )
##
## Split one data.frame
##
tstDF2. <- rbind(cbind(tstDF2, z1=1),
cbind(tstDF2b, z1=2) )
Qn2. <- qqnorm2s('y', 'z1', tstDF2.)
# Plot has only one line, because only 1 y variable.
##
## Two data.frames without z
##
Qn2.0 <- qqnorm2s('y',
data.=list(tstDF2, tstDF2b),
outnames=c('ok', 'oops'), log='x' )