Dear all


I am having trouble with subsetting an ffdf object, hopefully somebody can 
help...



I have an index, which is a ff object of vmode "logical":

> index.SAS

ff (open) logical length=4977231 (4977231)

      [1]       [2]       [3]       [4]       [5]       [6]       [7]       [8] 
          [4977224] [4977225] [4977226] [4977227] [4977228] [4977229]

     TRUE      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE 
        :      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE

[4977230] [4977231]

     TRUE      TRUE



I would like to use this index to subset the ffdf object "data.SAS". The number 
of rows in data.SAS equals the length of index.SAS. However, the command

> Missing.data <- subset(data.SAS, !index.SAS)



gives me the following error:

Error in ffdf(x = x) : ffdf components must be atomic ff objects



A similar command also results in an error:

> Missing.data <- data.SAS[!index.SAS,]

Error: vmode(index) == "integer" is not TRUE



I do not want to use "index.SAS[]" (which works in many cases, but sometimes 
crashes), because - as far as I understand - this will cause trouble with 
really large index vectors (I would prefer using ff objects).



So I came up with the following syntax, which seems to work:

> Missing.data <- data.SAS[ffwhich(index.SAS,index.SAS==FALSE),]



...I am just not sure if this is the right approach.



I am running



platform       i386-w64-mingw32

arch           i386

os             mingw32

system         i386, mingw32

status

major          3

minor          0.3

year           2014

month          03

day            06

svn rev        65126

language       R

version.string R version 3.0.3 (2014-03-06)

nickname       Warm Puppy



with ffbase_0.11.3 and ff_2.2-12



Many thanks in advance

Christian


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to