Description Usage Arguments Value Examples
Compare two data-frame (like) objects. The function will compare the objects by column names, and print information about differences.
1 2 3 4 5 6 7 8 | compare_dfs(
df1,
df2,
printColDiffs = 1,
tol = 1e-10,
trim = TRUE,
blankEqualsNA = FALSE
)
|
df1 |
The first object inheriting from a data.frame. |
df2 |
The second object inheriting from a data.frame. |
printColDiffs |
What level of messages to print regarding the differences between columns (integer scalar). |
tol |
The acceptable tolerance for equality between numeric columns (numeric scalar). |
trim |
Whether or not to trim whitespace from character columns (logical scalar). |
blankEqualsNA |
Whether or not blanks and considered equal to NA in character vectors (logical scalar). |
A list of column comparison data for each non-identical column.
1 2 3 4 5 6 7 8 9 10 11 | # Returns an empty list, since the objects are identical
compare_dfs(mtcars, mtcars)
# Prints a message about the difference in column names
compare_dfs(mtcars, mtcars[, -1])
# Prints a message about the difference in values, & returns a tibble showing the differences
compare_dfs(mtcars, dplyr::mutate(mtcars, mpg = mpg * 2))
# Same as the above, but doesn't print the message about the differences
compare_dfs(mtcars, dplyr::mutate(mtcars, mpg = mpg * 2), printColDiffs = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.