Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目前,我有两个矩阵,想比较一下,看看它们是否完全等价。在 R 中,是否有任何功能可以做到这一点?
如上所述,以?all.equalor开头?identical。如果您随后发现您的矩阵不相等,您可能需要逐列比较它们。这可能会奏效:
?all.equal
?identical
mapply(as.data.frame(m1),as.data.frame(m2),FUN=function(v1,v2) all(v1==v2) )