更新时间:2023-12-01 11:58:22
Base R的table()
将为您提供服务:
Base R's table()
will get you what you're after:
x <- with(nn, table(actors, partners))
x + t(x)
# partners
# actors DOL JOJ NIN NOR
# DOL 0 2 1 3
# JOJ 2 0 0 2
# NIN 1 0 0 2
# NOR 3 2 2 0