How to use Summary Function in R? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The summary() function provides a quick statistical overview of a given dataset or vector. When applied to numeric data, it returns the following key summary statistics:Min: The minimum value in the data1st Qu: The first quartile (25th percentile)Median: The middle value (50th percentile)3rd Qu: The third quartile (75th percentile)Max: The maximum value in the dataSyntax:summary(data)Where, data can be a vector, dataframe, etc. In this article, we will explore the summary() function in the R programming language.Using summary() with VectorHere we are going to create a vector with some elements and get the summary statistics using the summary() function. R data = c(1: 5, 56, 43, 56, 78, 51) print(data) print(summary(data)) Output:Using summary() with DataFrameHere we are going to get the summary of all columns in the dataframe. R data = data.frame(col1=c(1: 5, 56, 43, 56, 78, 51), col2=c(100: 104, 56, 43, 56, 78, 51), col3=c(1: 5, 34, 56, 78, 76, 79)) print(data) print(summary(data)) Output:Using summary() with Specific DataFrame ColumnsHere we can get summary of particular columns of the dataframe.Syntax:summary(dataframe[c 1="'column2',..,column" 2="n)" language="('column1',"][/c]) R data = data.frame(col1=c(1: 5, 56, 43, 56, 78, 51), col2=c(100: 104, 56, 43, 56, 78, 51), col3=c(1: 5, 34, 56, 78, 76, 79)) print(data) print(summary(data[c('col1', 'col3')])) Output:Using summary() with Regression ModelHere we can also calculate summary() for linear regression model. We can create an linear regression model for dataframe columns using lm() function.Syntax:summary(lm(column1~column2, dataframe)) R data = data.frame(col1=c(1: 5, 56, 43, 56, 78, 51), col2=c(100: 104, 56, 43, 56, 78, 51)) reg = lm(col1~col2, data) summary(reg) Output:Using summary() with ANOVA ModelHere aov() is used to create ANOVA (Analysis of Variance) model which stands for analysis of variance.Syntax:summary(aov(col1 ~ col2, data))Example: R data = data.frame(col1=c(1: 5, 56, 43, 56, 78, 51), col2=c(100: 104, 56, 43, 56, 78, 51)) reg = aov(col1 ~ col2, data) summary(reg) Output: Comment More infoAdvertise with us Next Article How to Use aggregate Function in R M manojkumarreddymallidi Follow Improve Article Tags : R Language R Functions Similar Reads How to Use sum Function in R? In this article, we will discuss how to use the sum() function in the R Programming Language. sum() function: This is used to return the total/sum of the given data Syntax: sum(data) Arguments: data can be a vector or a dataframeExample 1: Using sum() function to calculate the sum of vector elements 5 min read How to Use aggregate Function in R The aggregate() function in R Programming Language is used to calculate summary statistics on a dataset, grouped by one or more variables. This function is helpful when we need to break down data into subsets based on certain criteria, such as grouping data by categories or variables and then calcul 3 min read How to Perform a SUMIF Function in R? In this article, we will discuss the sumif function in R Programming Language. This function is used to group the data and get the sum of the values by a group of values in the dataframe, so we are going to perform this operation on the dataframe. Method 1: Perform a SUMIF Function On One Column: In 3 min read sum() function in R sum() function in R Programming Language returns the addition of the values passed as arguments to the function.Syntax:sum(...)Parameters: ...: numeric or complex or logical vectors1. Using Sum() function to Add two NumbersWe will create a vector a1 with the values 12 and 13, and then calculate the 3 min read How to Create Summary Tables in R? In this article, we will discuss how to create summary tables in R Programming Language. The summary table contains the following information: vars: represents the column numbern: represents the number of valid casesmean: represents the mean valuemedian: represents the median valuetrimmed: represent 4 min read How to View the Source Code for a Function in R? If you're diving into R programming, there will come a time when you want to look under the hood and see how a function works. Maybe you're curious about the mechanics, or you want to understand it better to use it more effectively. Here's a guide to help you view the source code for a function in R 4 min read Like