View source: R/identicalSlots.R
identicalSlots | R Documentation |
Judge if the slots in two S4 objects are identical
identicalSlots(obj1, obj2, slots = NULL, isList = FALSE)
obj1 |
First S4 object |
obj2 |
Second S4 object |
slots |
The slot names, the default is NULL, which means all of the slot names in the first object. |
isList |
logical, is the obj1 or obj2 a list, the default is FALSE. |
A list of two elements (FALSE and TRUE) if both exists. The slot names in the FALSE element are not identical between two objects. In contrast, the slot names in the TRUE element are identical between two objects.
## Not run:
library(Matrix)
i = c(1,3:8)
j = c(2,9,6:10)
x = 7 * (1:7)
(A = sparseMatrix(i, j, x = x))
identicalSlots(A, A)
y = x + 1
(B = sparseMatrix(i, j, x = y))
identicalSlots(A, B)
x = list(a = 1:3, b = letters)
y = list(a = 1:3, b = LETTERS)
identicalSlots(x, y, isList = T)
x = list(a = 1:3, b = letters, c = TRUE)
y = list(a = 1:3, b = LETTERS, c = TRUE)
identicalSlots(x, y, isList = T)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.