ID EN
Math Functions

summary

R Base 3.6.2

summary is a generic function used to produce result summaries of the results of various model fitting functions. The function invokes particular methods which depend on the class of the first argument.

Syntax

R
summary(object, &#8230;)<p></p><p># S3 method for default
summary(object, &#8230;, digits, quantile.type = 7)
# S3 method for data.frame
summary(object, maxsum = 7,
       digits = max(3, getOption("digits")-3), &#8230;)</p><p># S3 method for factor
summary(object, maxsum = 100, &#8230;)</p><p># S3 method for matrix
summary(object, &#8230;)</p><p># S3 method for summaryDefault
format(x, digits = max(3L, getOption("digits") - 3L), &#8230;)
 # S3 method for summaryDefault
print(x, digits = max(3L, getOption("digits") - 3L), &#8230;)</p>

Arguments

Parameter Description
object an object for which a summary is desired.
x a result of the default method of summary().
maxsum integer, indicating how many levels should be shown for factors.
digits integer, used for number formatting with signif() (for summary.default) or format() (for summary.data.frame). In summary.default, if not specified (i.e., missing(.)), signif() will not be called anymore (since R >= 3.4.0, where the default has been changed to only round in the print and format methods).
quantile.type integer code used in quantile(*, type=quantile.type) for the default method.
&#8230; additional arguments affecting the summary produced.

Return Value

The form of the value returned by summary depends on the class of its argument. See the documentation of the particular methods for details of what is produced by that method. The default method returns an object of class c("summaryDefault", "table") which has specialized format and print methods. The factor method returns an integer vector. The matrix and data frame methods return a matrix of class "table", obtained by applying summary to each column and collating the results.

Details

For factors, the frequency of the first maxsum - 1 most frequent levels is shown, and the less frequent levels are summarized in "(Others)" (resulting in at most maxsum frequencies). The functions summary.lm and summary.glm are examples of particular methods which summarize the results produced by lm and glm.

Examples

Example
R
# NOT RUN {
summary(attenu, digits = 4) #-> summary.data.frame(...), default precision
summary(attenu $ station, maxsum = 20) #-> summary.factor(...)

lst <- unclass(attenu$station) > 20 # logical with NAs
## summary.default() for logicals -- different from *.factor:
summary(lst)
summary(as.factor(lst))
# }

See Also

anova summary.glm summary.lm.