Comparing values of data frames in R Programming – all_equal() Function
all_equal() function in R Language is used to compare the values between data frames.
all_equal(target, current, check.attributes, check.names)
target: object to compare
current: object to be compared with
check.attributes: If attributes of both be compared
check.names: If names be compared
Example 1: Comparing Equal Data frames
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
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.