
# S3 method for data.frame
all.equal(target, current, ignore_col_order = TRUE,
ignore_row_order = TRUE, convert = FALSE, ...)
TRUE
if equal, otherwise a character vector describing
the first reason why they're not equal. Use isTRUE
if
using the result in an if
expression.scramble <- function(x) x[sample(nrow(x)), sample(ncol(x))]
# By default, ordering of rows and columns ignored
all.equal(mtcars, scramble(mtcars))
# But those can be overriden if desired
all.equal(mtcars, scramble(mtcars), ignore_col_order = FALSE)
all.equal(mtcars, scramble(mtcars), ignore_row_order = FALSE)
Run the code above in your browser using DataLab