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.
是否可以评估两个因素,查看它们是否具有相同数量的级别,如果是,哪些级别不存在于一个或另一个中?
如果factor1和factor2是您的两个因素,只需查看levels(factor1)和levels(factor2)。
factor1
factor2
levels(factor1)
levels(factor2)
相同的级别数:
length(levels(factor1)) == length(levels(factor2))
一个值而不是另一个值:
setdiff(levels(factor1), levels(factor2)) setdiff(levels(factor2), levels(factor1))