How to Calculate Five Number Summary in R? Last Updated : 03 Apr, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will discuss how to calculate five number summary in R programming language. Five number summary is also known as a boxplot. it will return five values that are : The minimum value present in the given dataThe first quartile value present in the given dataThe median value present in the given dataThe third quartile value present in the given dataThe maximum value present in the given dataMethod 1 : Using fivenum() This function will get the five-number summary of the given data Syntax: fivenum(data) Example 1: Get the fivenumber summary of the vector R # create the vector with 10 elements data=c(1:10) # get five summary print(fivenum(data)) Output: [1] 1.0 3.0 5.5 8.0 10.0 Example 2: Get the fivenumber summary in the dataframe R # create the dataframe with 4 columns data=data.frame(col1=c(1:10),col2=c(23:32), col3=c(11:20),col4=c(34:43)) # display print(data) # get five summary of col1 print(fivenum(data$col1)) # get five summary of col2 print(fivenum(data$col2)) # get five summary of col3 print(fivenum(data$col3)) # get five summary of col4 print(fivenum(data$col4)) Output: We can also get fivenumber summary from multiple columns at a time by using sapply with fivenum() function Syntax: sapply(dataframe[c 1="'column2',.......," 2="'column" 3="n')" language="('column1',"][/c], fivenum) Example: Get fivenumber summary from multiple columns at a time R # create the dataframe with 4 columns data=data.frame(col1=c(1:10),col2=c(23:32), col3=c(11:20),col4=c(34:43)) # display print(data) # get five summary of col1,col2,col3 print(sapply(data[c('col1','col2','col3')], fivenum)) Output: Method 2: Using boxplot() This will generate a plot that represents minimum, maximum, median, first, and third quartiles Syntax: boxplot(data) Example: Get the fivenum summary of the vector R # create the vector with 10 elements data=c(1:10) # get five summary print(boxplot(data)) Output: Comment More infoAdvertise with us Next Article How To Calculate Cumulative Sum By Group In R S sireeshakanneganti112 Follow Improve Article Tags : R Language R-Statistics Similar Reads How to Calculate a Five Number Summary in Excel? In statistics, the five-number summary is mostly used as it gives a rough idea about the dataset. It is basically a summary of the dataset describing some key features in statistics. The five key features are : Minimum value: It is the minimum value in the data setFirst Quartile, Q1: It is also know 3 min read How To Calculate Summary Statistics In Pandas Pandas, an incredibly versatile data manipulation library for Python, has various capabilities to calculate summary statistics on datasets. Summary statistics can give you a fast and comprehensive overview of the most important features of a dataset. In the following article, we will explore five me 4 min read How to Calculate Summary Statistics by Group in R? In this article, we will discuss how to calculate summary statistics by the group in the R programming language. What is summary statistics in R?Summary Statistics by Group in R Programming Language are numerical or graphical representations that provide a concise and informative overview of a datas 5 min read How to Calculate Geometric Mean in R? In this article, we will discuss how to calculate the Geometric Mean in R Programming Language.We can define the geometric mean as the average rate of return of a set of values calculated using the products of the terms.Method 1: Compute Geometric Mean ManuallyIn this method, the user can calculate 2 min read How To Calculate Cumulative Sum By Group In R The sum of a collection of numbers as the sum value increases with the number sequence is known as the cumulative sum. In data analysis tasks, it is essential to calculate cumulative sums within groups. This operation helps when we deal with time series or categorical data. In this article, we will 5 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 Like