0

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.

skeletonnoire
  • 81
  • 1
  • 1
  • 3
  • Please provide a small amount of your data. Also, try `x$q[x$z==1] <- ff("A")`? – User7598 Jun 01 '15 at 13:23
  • Sorry, that was meant to be x$q[x$z==1] <- ff("A") I have modified the original post. Didn't work though. – skeletonnoire Jun 01 '15 at 13:33
  • This is basically a duplicate of question: http://stackoverflow.com/questions/29538186/rffhow-to-add-a-new-column-which-depends-on-other-elements-in-the-same-row-in/29538691#29538691 –  Jun 03 '15 at 16:09

0 Answers0