I have an ffdf
object x
that holds a dataset with variables y
and z
. Due to millions of rows it needs to be stored as an ffdf
object. My question is this:
I want to create a new variable within this object q
, that is dependent on the value of z
.
z
takes three values: 1, 2, and 3, and when z=1 I would like q=A
, when z=2
, I would like q=B
and when z=3
, I would like q=C
.
In reality z has about 30 levels, and I have tried the ffifelse
statement which seems very inefficient. I have also tried the following:
x$q[x$z==1] <- ff("A")
but I then get the following error:
Error: length(value) == n is not TRUE
I would appreciate any help on transforming and creating new variables within an ffdf
object.