EVOLUTION-MANAGER
Edit File: all.equal.data.table.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Equality Test Between Two Data Tables</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for all.equal {data.table}"><tr><td>all.equal {data.table}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Equality Test Between Two Data Tables </h2> <h3>Description</h3> <p>Convenient test of data equality between <code>data.table</code> objects. Performs some factor level <em>stripping</em>. </p> <h3>Usage</h3> <pre> ## S3 method for class 'data.table' all.equal(target, current, trim.levels=TRUE, check.attributes=TRUE, ignore.col.order=FALSE, ignore.row.order=FALSE, tolerance=sqrt(.Machine$double.eps), ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>target, current</code></td> <td> <p><code>data.table</code>s to compare. If <code>current</code> is not a <code>data.table</code>, but <code>check.attributes</code> is FALSE, it will be coerced to one via <a href="as.data.table.html">as.data.table</a>. </p> </td></tr> <tr valign="top"><td><code>trim.levels</code></td> <td> <p>A logical indicating whether or not to remove all unused levels in columns that are factors before running equality check. It effect only when <code>check.attributes</code> is TRUE and <code>ignore.row.order</code> is FALSE. </p> </td></tr> <tr valign="top"><td><code>check.attributes</code></td> <td> <p>A logical indicating whether or not to check attributes, will apply not only to data.table but also attributes of the columns. It will skip <code>c("row.names",".internal.selfref")</code> data.table attributes. </p> </td></tr> <tr valign="top"><td><code>ignore.col.order</code></td> <td> <p>A logical indicating whether or not to ignore columns order in <code>data.table</code>. </p> </td></tr> <tr valign="top"><td><code>ignore.row.order</code></td> <td> <p>A logical indicating whether or not to ignore rows order in <code>data.table</code>. This option requires datasets to use data types on which join can be made, so no support for <em>list, complex, raw</em>, but still supports <a href="../../bit64/html/bit64-package.html">integer64</a>. </p> </td></tr> <tr valign="top"><td><code>tolerance</code></td> <td> <p>A numeric value used when comparing numeric columns, by default <code>sqrt(.Machine$double.eps)</code>. Unless non-default value provided it will be forced to <code>0</code> if used together with <code>ignore.row.order</code> and duplicate rows detected or factor columns present. </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Passed down to internal call of <code><a href="../../base/html/all.equal.html">all.equal</a></code>. </p> </td></tr> </table> <h3>Details</h3> <p>For efficiency data.table method will exit on detected non-equality issues, unlike most <code><a href="../../base/html/all.equal.html">all.equal</a></code> methods which process equality checks further. Besides that fact it also handles the most time consuming case of <code>ignore.row.order = TRUE</code> very efficiently. </p> <h3>Value</h3> <p>Either <code>TRUE</code> or a vector of mode <code>"character"</code> describing the differences between <code>target</code> and <code>current</code>. </p> <h3>See Also</h3> <p><code><a href="../../base/html/all.equal.html">all.equal</a></code> </p> <h3>Examples</h3> <pre> dt1 <- data.table(A = letters[1:10], X = 1:10, key = "A") dt2 <- data.table(A = letters[5:14], Y = 1:10, key = "A") isTRUE(all.equal(dt1, dt1)) is.character(all.equal(dt1, dt2)) # ignore.col.order x <- copy(dt1) y <- dt1[, .(X, A)] all.equal(x, y) all.equal(x, y, ignore.col.order = TRUE) # ignore.row.order x <- setkeyv(copy(dt1), NULL) y <- dt1[sample(nrow(dt1))] all.equal(x, y) all.equal(x, y, ignore.row.order = TRUE) # check.attributes x = copy(dt1) y = setkeyv(copy(dt1), NULL) all.equal(x, y) all.equal(x, y, check.attributes = FALSE) x = data.table(1L) y = 1L all.equal(x, y) all.equal(x, y, check.attributes = FALSE) # trim.levels x <- data.table(A = factor(letters[1:10])[1:4]) # 10 levels y <- data.table(A = factor(letters[1:5])[1:4]) # 5 levels all.equal(x, y, trim.levels = FALSE) all.equal(x, y, trim.levels = FALSE, check.attributes = FALSE) all.equal(x, y) </pre> <hr /><div style="text-align: center;">[Package <em>data.table</em> version 1.14.4 <a href="00Index.html">Index</a>]</div> </body></html>