[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  summary: Object Summaries

##  Description

` summary ` is a generic function used to produce result summaries of the
results of various model fitting functions. The function invokes particular `
[ methods ](/link/methods?package=base&version=3.6.2) ` which depend on the `
[ class ](/link/class?package=base&version=3.6.2) ` of the first argument.

##  Usage

    
    
    summary(object, …)
    
    # S3 method for default
    summary(object, …, digits, quantile.type = 7)
    # S3 method for data.frame
    summary(object, maxsum = 7,
           digits = max(3, getOption("digits")-3), …)
    
    # S3 method for factor
    summary(object, maxsum = 100, …)
    
    # S3 method for matrix
    summary(object, …)
    
    # S3 method for summaryDefault
    format(x, digits = max(3L, getOption("digits") - 3L), …)
     # S3 method for summaryDefault
    print(x, digits = max(3L, getOption("digits") - 3L), …)

##  Arguments

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 ` [ factor
](/link/factor?package=base&version=3.6.2) ` s.

digits

integer, used for number formatting with ` [ signif
](/link/signif?package=base&version=3.6.2) () ` (for ` summary.default ` ) or
` [ format ](/link/format?package=base&version=3.6.2) () ` (for `
summary.data.frame ` ). In ` summary.default ` , if not specified (i.e., ` [
missing ](/link/missing?package=base&version=3.6.2) (.) ` ), ` 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.

…

additional arguments affecting the summary produced.

##  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
](/link/table?package=base&version=3.6.2) ") ` which has specialized ` [
format ](/link/format?package=base&version=3.6.2) ` and ` [ print
](/link/print?package=base&version=3.6.2) ` methods. The ` [ factor
](/link/factor?package=base&version=3.6.2) ` method returns an integer vector.

The matrix and data frame methods return a matrix of class ` " [ table
](/link/table?package=base&version=3.6.2) " ` , obtained by applying ` summary
` to each column and collating the results.

##  Details

For ` [ factor ](/link/factor?package=base&version=3.6.2) ` s, 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
](/link/lm?package=base&version=3.6.2) ` and ` [ glm
](/link/glm?package=base&version=3.6.2) ` .

##  References

Chambers, J. M. and Hastie, T. J. (1992) _Statistical Models in S_ . Wadsworth
& Brooks/Cole.

##  See Also

` [ anova ](/link/anova?package=base&version=3.6.2) ` , ` [ summary.glm
](/link/summary.glm?package=base&version=3.6.2) ` , ` [ summary.lm
](/link/summary.lm?package=base&version=3.6.2) ` .

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fsummary&utm_source=r-docs&utm_medium=docs&utm_term=summary&utm_content=run_example_in_workspace)

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