Centar 15 Centar 15 - 3 months ago 9
R Question

splitting ff_vectors in r

Is there a way to perform a basic split of ff_vectors without any sums or such things? I have a ffdf called res2 consisting of 2 ff_vectors, and I want the following, from a ffdf like this:

A B
a 1
a 2
b 4
b 5


result should be a list like with the use of split function:

$a
1 2

$b
4 5


I want to create transactions out of these stuff and perform analysis on them, but I require to organize my data correctly first.

Answer

You can try,

split(df[, 'B'], df[,'A'])

which would give

#$a
#[1] 1 2

#$b
#[1] 4 5
Comments