try this feature
all.equal(df[1,],df[2,]) [1] "Attributes: < Component 2: Mean relative difference: 1 >"
(in the general case, comparative factors can give "unexpected" results ...) In this case, identity , trying to match everything, finds different row.names , you can see this from dput :
> dput(df[1,]) structure(list(x = structure(1L, .Label = c("x", "y"), class = "factor"), y = structure(2L, .Label = c("x", "y"), class = "factor")), .Names = c("x", "y"), row.names = 1L, class = "data.frame") > dput(df[2,]) structure(list(x = structure(1L, .Label = c("x", "y"), class = "factor"), y = structure(2L, .Label = c("x", "y"), class = "factor")), .Names = c("x", "y"), row.names = 2L, class = "data.frame")
In this example, simple == works:
> df[1,]==df[2,] xy 1 TRUE TRUE