Question

I am coming across difficulties using the ff package, when attempting to create cross-products of a number of different keys. Using expand.ffgrid(), there are no issues when passing individual ff objects as below:

test_ff <- expand.ffgrid(a=ff(c(0,1,2)), b=ff(c(0,1))) #-- Runs fine

However, to productionise this for an environment where I don’t know the number of ff objects I’m passing in, I’d like to pass in those objects as a list, as shown below

test_ff <- expand.ffgrid(list(a=ff(c(0,1,2)), b=ff(c(0,1)))) #-- This fails

The documentation implies (not very clearly) that this should be possible, and this syntax works fine using expand.grid(). Is this functionality that is not yet implemented in ff or am I missing something?

My original problem is to create a full outer join over a number of dataframes – this not being easy (or possible?) in ff really is causing me a headache!

Was it helpful?

Solution

Currently lists are not implemented but why not use do.call in that case? As in

require(ffbase)
x <- list(a=ff(c(0,1,2)), b=ff(c(0,1)))
test_ff <- do.call(expand.ffgrid, x)

I'll add the feature request on github

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top