我正在尝试解决问题,使数据框中的crosstable由两个变量(文章ID和用户ID)组成我试图从数据框中创建一个交叉表。将使用该交叉表来查找用户和文章的学位中心性。我有像
这样的数据框架article user
1 u1
1 u2
1 u3
2 u2
2 u4
2 u5
3 u1
3 u6
3 u4
3 u7
这只是一个例子,我有维度的数据框
dim(x)
[1] 364323 2
当我将代码应用于数据框时,它会给我一个错误,如
n<-(table(y)>0)*1 ##Error: cannot allocate vector of size 2.4 Gb
与交叉表相同
article users
u1 u2 u3 u4 u5 u6 u7
1 1 1 1 0 0 0 0
2 0 1 0 1 1 0 0
3 1 0 0 1 0 1 1
附加警告
Error: cannot allocate vector of size 12.9 Gb
In addition: Warning messages:
1: In matrix(0L, nc = n.u, nr = n.u) :
Reached total allocation of 4078Mb: see help(memory.size)
2: In matrix(0L, nc = n.u, nr = n.u) :
Reached total allocation of 4078Mb: see help(memory.size)
3: In matrix(0L, nc = n.u, nr = n.u) :
Reached total allocation of 4078Mb: see help(memory.size)
4: In matrix(0L, nc = n.u, nr = n.u) :
Reached total allocation of 4078Mb: see help(memory.size)
任何帮助都将受到高度赞赏