summary()
summary gives a quick report card for your data, showing key facts like the smallest, middle, and biggest values. It helps you get to know a dataset in one line.
In this page:
Syntax
summary(x)
summary(df)
summary()
summary() produces a quick statistical overview of a numeric vector or data frame -- minimum, 1st quartile, median, mean, 3rd quartile, and maximum.
Applied to a whole data frame, it summarizes every column at once. It's usually the very first function run after loading a new dataset to get a quick sense of its shape.
Note:
summary(df) run on a whole data frame gives you a quick per-column overview in one call.
Example: summary()
values <- c(23, 5, 67, 12, 45, 30, 8)
print(summary(values))
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
Common Mistakes
- Expecting
summary()to return only numbers, when for a factor or character it gives counts or class information. - Forgetting that
summary()on a vector withNAshows a separateNA'scount while the other stats ignore them. - Assuming the Mean and Median are the same value, when a large gap between them shows skewed data.
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: