A ff matrix of 300,000 rows and 1000 columns:
x <- ff(1: 100000000, vmode = "integer", dim = c (300000, 1000), dimorder = c (2,1))
I want to delete the last line of the matrix use the command:
x[-300000,]
However,I got the error: "can not allocate vector of size 1.1 Gb", it seems that x[-300000,]
is no longer returned ff object , but directly stored in the memory of all. So I have two questions :
- How to delete the i-th row ( or column ) of the matrix x in, and then still return ff object.
- how to select the rows or subset of which the j-th column equals 100 (an integer), and then still return ff object.
Maybe the functions ffwhich
and subset.ff
in ff
package could help me, but I do not understand how to use them.