You can use the following construct cbind.ffdf2
, making sure the column names of the two input ffdf
's are not duplicate:
library(ff)
ff1 <- as.ffdf(data.frame(letA = letters[1:5], numA = 1:5))
ff2 <- as.ffdf(data.frame(letB = letters[6:10], numB = 6:10))
cbind.ffdf2 <- function(d1, d2){
D1names <- colnames(d1)
D2names <- colnames(d2)
mergeCall <- do.call("ffdf", c(physical(d1), physical(d2)))
colnames(mergeCall) <- c(D1names, D2names)
mergeCall
}
cbind.ffdf2(ff1, ff2)[,]
Result:
letA numA letB numB
1 a 1 f 6
2 b 2 g 7
3 c 3 h 8
4 d 4 i 9
5 e 5 j 10
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…