compare | R Documentation |
Compare two objects as sets.
compare(A, B, ...)
## S3 method for class 'data.frame'
compare(A, B, zoom = TRUE, ...)
## Default S3 method:
compare(A, B, ...)
## S3 method for class ''function''
compare(A, B, useSource = TRUE, external = FALSE,
viewer = if (.Platform$OS.type == "windows") "winmerge" else "kompare",
...)
A |
object to compare. |
B |
object to compare. |
... |
passed to |
zoom |
whether to show only data frame columns whose values differ. |
useSource |
whether source code format and comments matter, otherwise R standard format is used. |
external |
whether to compare using an external viewer. |
viewer |
an external program to use if |
List with 4 elements:
both |
items found in both objects |
A |
items found only in A |
B |
items found only in B |
same.data |
whether objects contain the same set of items |
Set comparison ignores duplicates and order: c(1,1,2,3)
and
c(3,2,1)
are similar. Similarly, when comparing two functions, the
following are the same set:
f <- function(x) g <- function(x) { { y <- 1 y <- 3 y <- 1 y <- 2 y <- 2 y <- 1 y <- 3 } }
Data frames are compared line by line, and must have the same dimensions.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.