简体   繁体   中英

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 ?

You could try subset from ffbase

library(ffbase)
Subiris <- subset(irisdf, select=c('Sepal.Length', 'Species'))
dim(Subiris)
#[1] 150   2
colnames(Subiris)
#[1] "Sepal.Length" "Species"     
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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM