'In R: How can I check if multiple columns are identical between two datasets in one line of code?

I have two datasets that have the same information in columns 7 through 10, but in the opposite order. If I check each column individually, I a "True" for each execution.

> identical(d_activity[10], d_intensities[7])
[1] TRUE
> identical(d_activity[9], d_intensities[8])
[1] TRUE
> identical(d_activity[8], d_intensities[9])
[1] TRUE
> identical(d_activity[7], d_intensities[10])
[1] TRUE

However, if I try to compare them all at once, I get a "False". Is comparing multiple columns at once not possible? Or is there error in my code? I could only find examples of comparing one column. Thanks in advance for any assistance.

> identical(d_activity[10, 9, 8, 7], d_intensities[7, 8, 9, 10])
[1] FALSE
r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source