Comparing values of data frames in R Programming - all_equal() Function Last Updated : 15 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report all_equal() function in R Language is used to compare the values between dataframes. Syntax: all_equal(target, current, check.attributes, check.names) Parameters: target: object to comparecurrent: object to be compared withcheck.attributes: If attributes of both be comparedcheck.names: If names be comparedR - compare values of data frames Example 1: Comparing Equal Data frames R # R program to illustrate # all_equal function # Create three data frames data1 <- data.frame(x1 = 1:10, x2 = LETTERS[1:10]) data2 <- data.frame(x1 = 1:10, x2 = LETTERS[1:10]) data3 <- data.frame(x1 = 2:12, x2 = LETTERS[1:5]) # Compare equal data frames all_equal(data1, data2, check.attributes = FALSE) Output: TRUE Here in the above code, we have compared equal data frames data1 and data2, and thus the output seems to be "TRUE". Example 2: Comparing Unequal dataframes R # R program to illustrate # all_equal function # Create three data frames data1 <- data.frame(x1 = 1:10, x2 = LETTERS[1:10]) data2 <- data.frame(x1 = 1:10, x2 = LETTERS[1:10]) data3 <- data.frame(x1 = 2:12, x2 = LETTERS[1:5]) # Compare unequal data frames all_equal(data1, data3, check.names = FALSE) Output: Rows in x but not y: 1, 2, 3, 4, 5, 6, 8, 9, 10. Rows in y but not x: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Here in the above code, we compared the unequal data frames data1 and data3, so we got an error explaining what's wrong in the code. Comment More infoAdvertise with us Next Article Create Subsets of a Data frame in R Programming - subset() Function A akhilsharma870 Follow Improve Article Tags : R Language Similar Reads Create Subsets of a Data frame in R Programming - subset() Function subset() function in R Programming Language is used to create subsets of a Data frame. This can also be used to drop columns from a data frame.Syntax: subset(df, expr)Parameters: df: Data frame usedexpr: Condition for subsetCreate Subsets of Data Frames in R Programming LanguageHere we will make sub 3 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 Merge Two Data Frames by common Columns in R Programming - merge() Function merge() function in R Language is used to merge two data frames by common columns. Syntax: merge(arg1, arg2, by.x, by.y) Parameters: arg1 and arg2: Data frames to be merged by.x: Common argument of first data frame by.y: Common argument of second data frame Example 1: Python3 1== # R program to merg 1 min read Compare two Objects for Equality in R Programming - identical() Function identical() function in R Language is used to return TRUE when two objects are equal else return FALSE. Syntax: identical(a, b)Parameters: a, b: specified two objects  Example 1:  Python3 # R program to illustrate # identical function # Calling the identical() function identical(factorial(3), gamm 2 min read Check if values in a vector are True or not in R Programming - all() and any() Function In this article, we are going to check if the values in a vector are true or not in R Programming Language. R - all() function all() function in R Language will check in a vector whether all the values are true or not. Syntax: all(x, na.rm) Parameters: x: vectorna.rm: logical, if NA value to remov 2 min read Convert a Data Frame into a Numeric Matrix in R Programming - data.matrix() Function data.matrix() function in R Language is used to create a matrix by converting all the values of a Data Frame into numeric mode and then binding them as a matrix. Syntax: data.matrix(df) Parameters: df: Data frame to be converted. Example 1: Python3 1== # R program to convert a data frame # into a nu 2 min read Like