You could try to coerce as.matrix
before setdiff
.
list(df1, df2) |> lapply(as.matrix) |> do.call(what='setdiff')
# [1] 21.000 22.800 18.700 18.100 14.300 24.400 17.800 16.400 10.400 160.000 108.000
# [12] 258.000 360.000 225.000 146.700 140.800 167.600 275.800 472.000 460.000 110.000 93.000
# [23] 105.000 62.000 95.000 123.000 180.000 205.000 215.000 3.900 3.850 3.210 3.690
# [34] 3.920 3.070 2.930 2.620 2.875 2.320 3.215 3.440 3.460 3.190 4.070
# [45] 3.780 5.250 5.424 16.460 17.020 18.610 19.440 20.220 15.840 20.000 22.900
# [56] 18.300 17.400 17.600 18.000 17.980 17.820
Data:
df1 <- mtcars[1:16, ] |> `rownames<-`(NULL)
df2 <- mtcars[-(1:16), ] |> `rownames<-`(NULL)