@ у karakfa была правильная идея. Мы можем использовать хеши, чтобы узнать, какие матрицы одинаковы или различны, в зависимости от ваших потребностей.
library(dplyr)
# Create all your matricies
x = matrix(1:100, nrow=10)
y = matrix(1:100, nrow=10)
z = matrix(101:200, nrow=10)
# Get a list of all objects
lst = lapply(mget(ls()), function(obj) {
if (is.matrix(obj)) {
obj
} else {
NULL
}
})
# Filter out NULLs
lst = Filter(Negate(is.null), lst)
# Create a list of hashes
md5s = lapply(lst, function(obj) digest::digest(obj))
# Create a dataframe of the object names and hashes
df = data_frame(obj=names(lst), md5=unlist(md5s))
# Create a count to find those that are or are not unique
df %>%
group_by(md5) %>%
summarise(n = n())
# A tibble: 2 x 2
md5 n
<chr> <int>
1 2511f4beaee85d31d7e2e7746db9f627 2
2 502156778a19de62d2db1832bbe201e2 1