The R Project SVN R

Rev

Rev 61153 | Rev 65208 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61153 Rev 61168
Line 17... Line 17...
17
    from the box.  If \code{coef} is positive, the whiskers extend to the
17
    from the box.  If \code{coef} is positive, the whiskers extend to the
18
    most extreme data point which is no more than \code{coef} times
18
    most extreme data point which is no more than \code{coef} times
19
    the length of the box away from the box. A value of zero causes
19
    the length of the box away from the box. A value of zero causes
20
    the whiskers
20
    the whiskers
21
    to extend to the data extremes (and no outliers be returned).}
21
    to extend to the data extremes (and no outliers be returned).}
22
  \item{do.conf,do.out}{logicals; if \code{FALSE}, the \code{conf} or
22
  \item{do.conf, do.out}{logicals; if \code{FALSE}, the \code{conf} or
23
    \code{out} component respectively will be empty in the result.}
23
    \code{out} component respectively will be empty in the result.}
24
}
24
}
25
\description{
25
\description{
26
  This function is typically called by another function to
26
  This function is typically called by another function to
27
  gather the statistics necessary for producing box plots,
27
  gather the statistics necessary for producing box plots,
Line 100... Line 100...
100
 nn <- 1:17 ;  n4 <- nn \%\% 4
100
 nn <- 1:17 ;  n4 <- nn \%\% 4
101
 hin <- sapply(sapply(nn, seq), function(x) boxplot.stats(x)$stats[c(2,4)])
101
 hin <- sapply(sapply(nn, seq), function(x) boxplot.stats(x)$stats[c(2,4)])
102
 q13 <- sapply(sapply(nn, seq), quantile, probs = c(1,3)/4, names = FALSE)
102
 q13 <- sapply(sapply(nn, seq), quantile, probs = c(1,3)/4, names = FALSE)
103
 m <- t(rbind(q13,hin))[, c(1,3,2,4)]
103
 m <- t(rbind(q13,hin))[, c(1,3,2,4)]
104
 dimnames(m) <- list(paste(nn), c("q1","lH", "q3","uH"))
104
 dimnames(m) <- list(paste(nn), c("q1","lH", "q3","uH"))
105
 stopifnot(m[n4 == 1, 1:2] == (nn[n4 == 1] + 3)/4,# quart. = hinge
105
 stopifnot(m[n4 == 1, 1:2] == (nn[n4 == 1] + 3)/4,   # quart. = hinge
106
           m[n4 == 1, 3:4] == (3*nn[n4 == 1] + 1)/4,
106
           m[n4 == 1, 3:4] == (3*nn[n4 == 1] + 1)/4,
107
           m[,"lH"] == ( (nn+3) \%/\% 2) / 2,
107
           m[,"lH"] == ( (nn+3) \%/\% 2) / 2,
108
           m[,"uH"] == ((3*nn+2)\%/\% 2) / 2)
108
           m[,"uH"] == ((3*nn+2)\%/\% 2) / 2)
109
 cm <- noquote(format(m))
109
 cm <- noquote(format(m))
110
 cm[m[,2] == m[,1], 2] <- " = "
110
 cm[m[,2] == m[,1], 2] <- " = "