Here's how I'd do it.
library(tidyverse)
# define data
D1 <- data.frame(A = c(1, 2, 3, 4), B = c(4, 5, 6, 7))
D2 <- data.frame(C = c(1, 4), D = c(2, 5), E = c(9, 9), F = c(9, 9))
# check each row
Check <- map2_lgl(
D1 %>% as.matrix() %>% split(1:nrow(.)),
D2 %>% as.matrix() %>% t() %>% split(1:nrow(.)),
identical
)
# vector of whether each row is identical
print(Check)
#> 1 2 3 4
#> TRUE TRUE FALSE FALSE
# number of identical rows
print(sum(cumall(Check)))
#> [1] 2
Created on 2021-05-31 by the reprex package (v1.0.0)