2

我正在使用ffandffbase包来组合两个ffdf对象,但是当我使用该merge语句时,它从目标中的 100 万行ffdf变为 800 万行。

ffdf1 是 100 万行乘 6 列:

> summary(ffdf2)
              Length  Class     Mode
userid        1000000 ff_vector list
V2            1000000 ff_vector list
V3            1000000 ff_vector list
V4            1000000 ff_vector list
V5            1000000 ff_vector list
V6            1000000 ff_vector list

ffdf2 约为 2000 万行 X 3 列,如下所示:

  userid      gender      age
    1         1          3
    2         1          2
    3         2          5
    4         0          4
    5         2          3
    ...       ...       ...

我使用以下代码将两者合并:

ffdf3 <- merge(ffdf1, ffdf2, by.x="userid",by.y="userid",all.x=T,sort=F)

结果是这样的:

> summary(ffdf3)
                  Length  Class     Mode
    userid        8000000 ff_vector list
    V2            8000000 ff_vector list
    V3            8000000 ff_vector list
    V4            8000000 ff_vector list
    V5            8000000 ff_vector list
    V6            8000000 ff_vector list
    gender        8000000 ff_vector list
    age           8000000 ff_vector list

任何想法为什么长度从 1 毫米到 8 毫米?

编辑:

当我尝试这个时:

ffdf3 <- merge(ffdf1, ffdf2, by.x="userid",by.y="userid",all.x=F,sort=F)

我得到:

> summary(ffdf3)
                      Length  Class     Mode
        userid        740383 ff_vector list
        V2            740383 ff_vector list
        V3            740383 ff_vector list
        V4            740383 ff_vector list
        V5            740383 ff_vector list
        V6            740383 ff_vector list
        gender        740383 ff_vector list
        age           740383 ff_vector list

这里也是运行合并的输出:

2012-05-13 14:49:06, x has 2 chunks, y has 8 chunks
2012-05-13 14:49:06, working on x chunk 1:500000
2012-05-13 14:49:07, working on y chunk 1:2958661
2012-05-13 14:49:16, working on y chunk 2958662:5917322
2012-05-13 14:49:32, working on y chunk 5917323:8875983
2012-05-13 14:49:45, working on y chunk 8875984:11834644
2012-05-13 14:49:57, working on y chunk 11834645:14793305
2012-05-13 14:50:09, working on y chunk 14793306:17751966
2012-05-13 14:50:20, working on y chunk 17751967:20710627
2012-05-13 14:50:30, working on y chunk 20710628:23669283
2012-05-13 14:50:40, working on x chunk 500001:1000000
2012-05-13 14:50:41, working on y chunk 1:2958661
2012-05-13 14:50:52, working on y chunk 2958662:5917322
2012-05-13 14:51:03, working on y chunk 5917323:8875983
2012-05-13 14:51:14, working on y chunk 8875984:11834644
2012-05-13 14:51:24, working on y chunk 11834645:14793305
2012-05-13 14:51:36, working on y chunk 14793306:17751966
2012-05-13 14:51:47, working on y chunk 17751967:20710627
2012-05-13 14:51:58, working on y chunk 20710628:23669283

ffdf1包含 677840 个唯一userid的。所以在 1mm 行中有一些重复。

4

1 回答 1

3

merge.ffdf 包含一个错误,目前只允许正确进行内部连接,而不是 all.x=TRUE 和 all.y=FALSE。该功能适用​​于@ http://code.google.com/p/fffunctions/。问题是当您没有匹配的记录时,在进行左外连接时,需要更改 vmode 才能正确允许 NA。这正在处理中。

供参考。现在在http://code.google.com/p/fffunctions/的开发版本中解决了这个问题,并将在未来几周内上传到 CRAN。

于 2012-05-16T14:32:34.937 回答