Condense Column Values of a Data Frame in R Programming - summarise() Function Last Updated : 19 Jun, 2020 Comments Improve Suggest changes Like Article Like Report summarise() function in R Language is used to condense various values of column of a data frame to one value. Syntax: summarise(x, expr) Parameters: x: Data Frame expr: Operation to condense data Example 1: Python3 1== # R program to condense data # of a data frame # Loading library library(dplyr) # Create a data frame d <- data.frame( name = c("Abhi", "Bhavesh", "Chaman", "Dimri"), age = c(7, 5, 9, 16), ht = c(46, NA, NA, 69), school = c("yes", "yes", "no", "no") ) # Calculating min age summarise(d, min_age = min(age)) # Calculating max age summarise(d, max_age = max(age)) Output: min_age 1 5 max_age 1 16 Example 2: Python3 1== # R program to condense data # of a data frame # Loading library library(dplyr) # Create a data frame d <- data.frame( name = c("Abhi", "Bhavesh", "Chaman", "Dimri"), age = c(7, 5, 9, 16), ht = c(46, NA, NA, 69), school = c("yes", "yes", "no", "no") ) # Calculating mean of age summarise(d, mean = mean(age)) # Calculating median of age summarise(d, med = median(age)) Output: mean 1 9.25 med 1 8 Comment More infoAdvertise with us Next Article Condense Column Values of a Data Frame in R Programming - summarise() Function N nidhi_biet Follow Improve Article Tags : R Language R DataFrame-Function Similar Reads Take Random Samples from a Data Frame in R Programming - sample_n() Function sample_n() function in R Language is used to take random sample specimens from a data frame. Syntax: sample_n(x, n) Parameters: x: Data Frame n: size/number of items to select Example 1: Python3 1== # R program to collect sample data # from a data frame # Loading library library(dplyr) # Create a da 1 min read Convert an Object to Data Frame in R Programming - as.data.frame() Function as.data.frame() function in R Programming Language is used to convert an object to data frame. These objects can be Vectors, Lists, Matrices, and Factors. Syntax: as.data.frame(object) Parameters:Â object: Vector, Matrix, factor, or data frameR - as.data.frame() Function ExampleExample 1: Basic exam 2 min read Calculate the Sum of Matrix or Array columns in R Programming - colSums() Function colSums() function in R Language is used to compute the sums of matrix or array columns. Syntax: colSums (x, na.rm = FALSE, dims = 1) Parameters: x: matrix or array dims: this is integer value whose dimensions are regarded as âcolumnsâ to sum over. It is over dimensions 1:dims. Example 1: Python3 # 2 min read Apply Function to data.table in Each Specified Column in R In this article, we are going to see that how to apply a function to data.table in each specified column in R Programming Language. The data.table library in R is used to create datasets and represent it in an organized manner. The library can be downloaded and installed into the working space using 3 min read Calculate Cumulative Sum of a Numeric Object in R Programming - cumsum() Function The cumulative sum can be defined as the sum of a set of numbers as the sum value grows with the sequence of numbers. cumsum() function in R Language is used to calculate the cumulative sum of the vector passed as argument. Syntax: cumsum(x)Â Parameters:Â x: Numeric Object Example 1:Â Python3 # R pr 1 min read Like