1

I've tried to add a Source column to my ffdf, but can't seem to get it to work... if it was a normal df I would simply write

mtcars$NewCol <- "AB" 

If I do this for the ffdf it returns an error

require(ff)
require(ffbase)

mtcarsff <- as.ffdf(mtcars) 
mtcars$NewCol <- "testname"

Error in `[[<-.ffdf`(`*tmp*`, i, value = "testname") : 
assigned value must be ff

Any Ideas?

Jaap
  • 81,064
  • 34
  • 182
  • 193
Jacob Odom
  • 216
  • 1
  • 8

1 Answers1

2

This should work:

mtcarsff$NewCol <- as.ff(
    rep(factor("AB"), times = nrow(mtcarsff))
)

Note that "AB" must be considered a factor, not a character.

Miguel
  • 81
  • 4