Reading specific rows of large matrix data file

前端 未结 4 1010
粉色の甜心
粉色の甜心 2021-02-09 22:50

Suppose I have a gigantic m*n matrix X (that is too big to read into memory) and binary numeric vector V with length m. My objective is to

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-09 22:55

    ffdfindexget from ff package is what you are looking for:

    Function ffdfindexget allows to extract rows from an ffdf data.frame according to positive integer suscripts stored in an ff vector.

    So in your example:

    write.csv(X,"target.csv")
    d <- read.csv.ffdf(file="target.csv")
    i <- ff(which(V==1))
    di <- ffdfindexget(d, i)
    

提交回复
热议问题