all.equal.tbl_df {dplyr} | R Documentation |
Provide a useful implementation of all.equal for data.frames.
## S3 method for class 'tbl_df' all.equal(target, current, ignore_col_order = TRUE, ignore_row_order = TRUE, convert = FALSE, ...) ## S3 method for class 'tbl_dt' all.equal(target, current, ignore_col_order = TRUE, ignore_row_order = TRUE, convert = FALSE, ...)
target,current |
two data frames to compare |
ignore_col_order |
should order of columns be ignored? |
ignore_row_order |
should order of rows be ignored? |
convert |
Should similar classes be converted? Currently this will convert factor to character and integer to double. |
... |
Ignored. Needed for compatibility with the generic. |
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 mtcars_df <- tbl_df(mtcars) all.equal(mtcars_df, scramble(mtcars_df)) # But those can be overriden if desired all.equal(mtcars_df, scramble(mtcars_df), ignore_col_order = FALSE) all.equal(mtcars_df, scramble(mtcars_df), ignore_row_order = FALSE)