Search code examples
rffffbase

How to DROP columns from ffdf object ? (R)


Could I easily drop column of ffdf object ?

library(ff);library(ffbase)    
irisdf=as.ffdf(iris)

How to contain only Sepal.length and Species columns ?


Solution

  • library(ff)  
    irisdf <- as.ffdf(iris)
    filename(irisdf)
    ## Referencing the same data on disk (just making an new virtual ffdf)
    example1 <- irisdf[setdiff(colnames(irisdf), c("Sepal.Length", "Species"))]
    filename(example1)
    ## Referencing new data (copying)
    example2 <- clone(irisdf[setdiff(colnames(irisdf), c("Sepal.Length", "Species"))])
    filename(example2)