简体   繁体   中英

How to cast ffdf to ff

I am using the read.table.ffdf function from the ff package to read a gigantic matrix of numbers. How do I then cast this resulting ffdf object to an ff object without first converting to RAM?

An simple test example is lacking where you show what you are doing. But I assume you have a ffdf with all columns of the same type, otherwise it does not make sense to convert it to an ff vector or ff matrix.

If you want to convert to an ff matrix, you can use as.ff_matrix.ffdf which is unexported in ffbase, so access it with ffbase:::as.ff_matrix.ffdf as in the following example.

require(ffbase)
x <- expand.ffgrid(a = ff(1:10), b = ffseq(1,1000))
y <- ffbase:::as.ff_matrix.ffdf(x)
class(y)
[1] "ff_matrix" "ff_array"  "ff"

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