summary.factor
Use summary() on a factor Object

Description

This is an S3 method for the function summary for objects inheriting from class factor.

Usage

summary.factor(object, maxsum = 100, ...)

Arguments

object An object inherits from "factor".
maxsum the maximal number of levels to be shown in summary result. The first maxsum-1 levels are shown and the rest of levels will be combined(sum of the number of observations) in one cell named "(Other)". See example as below.
... additional arguments to pass to or from other methods.

Details

This is a method for the function summary() for objects inheriting from class factor. See summary or summary.default for the general behavior of this function and for the interpretation of object.
Examples
color <- c("red", "red", "red", "green", "grey", "white", "green", "blue")
colors <- factor(color, c("red", "green", "blue", "grey", "black", "white"))
summary(colors)
#  red green  blue  grey black white 
#    3     2     1     1     0     1 
summary(colors, maxsum = 4)
#    red   green    blue (Other) 
#      3       2       1       2 	 
Package base version 6.1.1-7
Package Index